terrylinooo / shieldon

Compare 7087037 ... +6 ... 53c625c

Showing 4 of 10 files from the diff.

@@ -22,7 +22,7 @@
Loading
22 22
use Shieldon\Log\ActionLogParsedCache;
23 23
use Shieldon\Shieldon;
24 24
use Shieldon\FirewallTrait;
25 -
use Messenger as MessengerModule;
25 +
use Shieldon\Messenger as MessengerModule;
26 26
27 27
use function Shieldon\Helper\__;
28 28
@@ -102,7 +102,7 @@
Loading
102 102
    protected $messages = [];
103 103
104 104
    /**
105 -
     * self: Shieldon | managed: Firewall
105 +
     * self: Shieldon | managed: Firewall | demo: Demo
106 106
     *
107 107
     * @var string
108 108
     */
@@ -132,7 +132,7 @@
Loading
132 132
     */
133 133
    protected $demoUser = [
134 134
        'user' => 'demo',
135 -
        'pass' => '$2y$10$MTi1ROPnHEukp5RwGNdxuOSAyhGdpc4sfQpwNCv9yHoVvgl9tz8Xy',
135 +
        'pass' => 'demo',
136 136
    ];
137 137
138 138
    /**
@@ -447,6 +447,13 @@
Loading
447 447
                password_verify($_POST['s_pass'], $admin['pass'])
448 448
            ) {
449 449
                $login = true;
450 +
451 +
            } elseif (
452 +
                $this->mode === 'demo' && 
453 +
                $this->demoUser['user'] === $_POST['s_user'] &&
454 +
                $this->demoUser['pass'] === $_POST['s_pass']
455 +
            ) {
456 +
                $login = true;
450 457
    
451 458
            } else {
452 459
                $data['error'] = __('panel', 'login_message_invalid_user_or_pass', 'Invalid username or password.');
@@ -1794,6 +1801,10 @@
Loading
1794 1801
     */
1795 1802
    protected function exportSettings()
1796 1803
    {
1804 +
        if ($this->mode !== 'managed') {
1805 +
            die('Not allowed to view this page.');
1806 +
        }
1807 +
1797 1808
        header('Content-type: text/plain');
1798 1809
        header('Content-Disposition: attachment; filename=shieldon-' . date('YmdHis') . '.json');
1799 1810
        header('Expires: 0');
@@ -1809,6 +1820,10 @@
Loading
1809 1820
     */
1810 1821
    protected function importSettings()
1811 1822
    {
1823 +
        if ($this->mode !== 'managed') {
1824 +
            die('Not allowed to view this page.');
1825 +
        }
1826 +
1812 1827
        if (! empty($_FILES['json_file']['tmp_name'])) {
1813 1828
            $importedFileContent = file_get_contents($_FILES['json_file']['tmp_name']);
1814 1829
        }
@@ -2145,10 +2160,6 @@
Loading
2145 2160
     */
2146 2161
    private function httpAuth(): void
2147 2162
    {
2148 -
        if ('demo' === $this->mode || 'self' === $this->mode) {
2149 -
            $admin = $this->demoUser;
2150 -
        }
2151 -
2152 2163
        if (! isset($_SESSION['SHIELDON_USER_LOGIN'])) {
2153 2164
            $this->login();
2154 2165
        }

@@ -36,7 +36,7 @@
Loading
36 36
use Shieldon\Container;
37 37
use Shieldon\Driver\DriverProvider;
38 38
use Shieldon\Log\ActionLogger;
39 -
use Messenger\Messenger\MessengerInterface;
39 +
use Shieldon\Messenger\Messenger\MessengerInterface;
40 40
use function Shieldon\Helper\get_cpu_usage;
41 41
use function Shieldon\Helper\get_memory_usage;
42 42
use function Shieldon\Helper\__;

@@ -10,7 +10,7 @@
Loading
10 10
11 11
namespace Shieldon\Mock;
12 12
13 -
use Messenger\Messenger\MessengerInterface;
13 +
use Shieldon\Messenger\Messenger\MessengerInterface;
14 14
15 15
/**
16 16
 * For unit-testing purpose.

@@ -28,7 +28,7 @@
Loading
28 28
use Shieldon\Security\Xss;
29 29
use Shieldon\Security\httpAuthentication;
30 30
use Shieldon\FirewallTrait;
31 -
use Messenger as MessengerModule;
31 +
use Shieldon\Messenger as MessengerModule;
32 32
33 33
use PDO;
34 34
use PDOException;

Learn more Showing 118 files with coverage changes found.

src/Firewall/Kernel/RuleTrait.php
Loading file...
src/Firewall/Kernel/ComponentTrait.php
Loading file...
src/Firewall/Firewall/Messenger/ItemNativePhpMail.php
Loading file...
src/Firewall/Firewall/SetupTrait.php
Loading file...
src/Firewall/Driver/AbstractDriver.php
Loading file...
src/Firewall/Panel/Setting.php
Loading file...
src/Firewall/Log/ActionLogger.php
Loading file...
src/Firewall/Log/ActionLogParsedCache.php
Loading file...
src/Firewall/Driver/SqlDriverProvider.php
Loading file...
src/Firewall/Firewall/Driver/DriverFactory.php
Loading file...
src/Firewall/Captcha/Foundation.php
Loading file...
src/Firewall/Panel/Sandbox/RocketChat.php
Loading file...
src/Firewall/Firewall/Messenger/ItemMailgun.php
Loading file...
src/Firewall/IpTrait.php
Loading file...
src/Firewall/Driver/FileDriver.php
Loading file...
src/Firewall/Panel/Sandbox/Sendgrid.php
Loading file...
src/Firewall/Firewall/Messenger/ItemSmtp.php
Loading file...
src/Firewall/Firewall/Driver/ItemRedisDriver.php
Loading file...
src/Firewall/Captcha/ReCaptcha.php
Loading file...
src/Firewall/Middleware/UserAgent.php
Loading file...
src/Firewall/Firewall/Captcha/ItemImage.php
Loading file...
src/Firewall/Firewall/Driver/ItemFileDriver.php
Loading file...
src/Firewall/Firewall/Captcha/CaptchaFactory.php
Loading file...
src/Firewall/Kernel/SessionTrait.php
Loading file...
src/Firewall/Panel/Sandbox/Smtp.php
Loading file...
src/Firewall/Driver/RedisDriver.php
Loading file...
src/Firewall/Kernel/DriverTrait.php
Loading file...
src/Firewall/Panel.php
Loading file...
src/Firewall/Component/Rdns.php
Loading file...
src/Firewall/Firewall/Messenger/ItemSendgrid.php
Loading file...
src/Firewall/Captcha/ImageCaptcha.php
Loading file...
src/Firewall/Driver/MysqlDriver.php
Loading file...
src/Firewall/Driver/SqlDriverTrait.php
Loading file...
src/Firewall/Component/DeniedTrait.php
Loading file...
src/Firewall/Middleware/Header.php
Loading file...
src/Firewall/Kernel/FilterTrait.php
Loading file...
src/Firewall/Firewall/Driver/ItemMysqlDriver.php
Loading file...
src/Firewall/Firewall/XssProtectionTrait.php
Loading file...
src/Firewall/Session.php
Loading file...
src/Firewall/Driver/SqliteDriver.php
Loading file...
src/Firewall/Firewall/Captcha/ItemRecaptcha.php
Loading file...
src/Firewall/Panel/Home.php
Loading file...
src/Firewall/Firewall/Messenger/MessengerTrait.php
Loading file...
src/Firewall/HttpFactory.php
Loading file...
src/Firewall/Panel/Sandbox/Mailgun.php
Loading file...
src/Firewall/Component/Header.php
Loading file...
src/Firewall/Panel/Sandbox/Slack.php
Loading file...
src/Firewall/FirewallTrait.php
Loading file...
src/Firewall/Driver/DriverProvider.php
Loading file...
src/Firewall/Panel/BaseController.php
Loading file...
src/Firewall/Component/ComponentProvider.php
Loading file...
src/Firewall/Panel/Iptables.php
Loading file...
src/Firewall/Panel/User.php
Loading file...
src/Firewall/Panel/Sandbox/LineNotify.php
Loading file...
src/Firewall/Firewall/Messenger/MessengerFactory.php
Loading file...
src/Firewall/Kernel/TemplateTrait.php
Loading file...
src/Firewall/Panel/Sandbox/NativePhpMail.php
Loading file...
src/Firewall/Panel/Circle.php
Loading file...
src/Firewall/Middleware/HttpAuthentication.php
Loading file...
src/Firewall/Panel/Asset.php
Loading file...
src/Firewall/Kernel.php
Loading file...
src/Firewall/Firewall/Messenger/ItemSlackWebhook.php
Loading file...
src/Firewall/Kernel/MessengerTrait.php
Loading file...
src/Firewall/Firewall.php
Loading file...
src/Firewall/Firewall/Messenger/ItemTelegram.php
Loading file...
src/Firewall/Component/TrustedBot.php
Loading file...
src/Firewall/Kernel/CaptchaTrait.php
Loading file...
src/Firewall/Container.php
Loading file...
src/Firewall/Component/UserAgent.php
Loading file...
src/Firewall/Firewall/Messenger/ItemSlack.php
Loading file...
src/Firewall/Panel/Ajax.php
Loading file...
src/Firewall/Panel/Security.php
Loading file...
src/Firewall/Panel/CsrfTrait.php
Loading file...
src/Firewall/Firewall/Driver/ItemSqliteDriver.php
Loading file...
src/Firewall/Component/Ip.php
Loading file...
src/Firewall/Captcha/CaptchaProvider.php
Loading file...
src/Firewall/Firewall/Messenger/ItemRocketChat.php
Loading file...
src/Firewall/HttpResolver.php
Loading file...
src/Firewall/Log/ActionLogParser.php
Loading file...
src/Firewall/Panel/Report.php
Loading file...
src/Firewall/Panel/Sandbox/Telegram.php
Loading file...
src/Firewall/Captcha/Csrf.php
Loading file...
src/Firewall/Panel/DemoModeTrait.php
Loading file...
src/Firewall/Driver/FileDriverTrait.php
Loading file...
src/Firewall/Firewall/Messenger/ItemLineNotify.php
Loading file...
src/Firewall/Panel/Sandbox/SlackWebhook.php
Loading file...
src/Firewall/Panel/ConfigMethodsTrait.php
Loading file...
src/Firewall/Component/AllowedTrait.php
Loading file...
New file src/Shieldon/Captcha/Recaptcha.php
New
Loading file...
New file src/Shieldon/Security/Xss.php
New
Loading file...
New file src/Shieldon/Captcha/Foundation.php
New
Loading file...
New file src/Shieldon/Captcha/Csrf.php
New
Loading file...
New file src/Shieldon/Component/TrustedBot.php
New
Loading file...
New file src/Shieldon/IpTrait.php
New
Loading file...
New file src/Shieldon/Component/Ip.php
New
Loading file...
New file src/Shieldon/Log/ActionLogParser.php
New
Loading file...
New file src/Shieldon/Security/Csrf.php
New
Loading file...
New file src/Shieldon/Container.php
New
Loading file...
New file src/Shieldon/Mock/Messenger.php
New
Loading file...
New file src/Shieldon/FirewallPanel.php
New
Loading file...
New file src/Shieldon/Driver/FileDriver.php
New
Loading file...
New file src/Shieldon/Shieldon.php
New
Loading file...
New file src/Shieldon/Log/ActionLogger.php
New
Loading file...
New file src/Shieldon/Driver/SqlDriverProvider.php
New
Loading file...
New file src/Shieldon/Component/ComponentProvider.php
New
Loading file...
New file src/Shieldon/Component/UserAgent.php
New
Loading file...
New file src/Shieldon/Component/Header.php
New
Loading file...
New file src/Shieldon/Driver/RedisDriver.php
New
Loading file...
New file src/Shieldon/Driver/MysqlDriver.php
New
Loading file...
New file src/Shieldon/Security/httpAuthentication.php
New
Loading file...
New file src/Shieldon/FirewallTrait.php
New
Loading file...
New file src/Shieldon/Log/ActionLogParsedCache.php
New
Loading file...
New file src/Shieldon/Driver/AbstractDriver.php
New
Loading file...
New file src/Shieldon/Driver/DriverProvider.php
New
Loading file...
New file src/Shieldon/Captcha/ImageCaptcha.php
New
Loading file...
New file src/Shieldon/Component/Rdns.php
New
Loading file...
New file src/Shieldon/Driver/SqliteDriver.php
New
Loading file...
New file src/Shieldon/Firewall.php
New
Loading file...
Files Complexity Coverage
src/Shieldon
New Folder
ø 99.30%
Project Totals (30 files) 855 99.30%
Loading