diff --git a/kirby/composer.json b/kirby/composer.json index af4770e..a681741 100755 --- a/kirby/composer.json +++ b/kirby/composer.json @@ -1,11 +1,15 @@ { "name": "getkirby/cms", - "description": "The Kirby 3 core", - "version": "3.5.0", - "license": "proprietary", - "keywords": ["kirby", "cms", "core"], - "homepage": "https://getkirby.com", "type": "kirby-cms", + "description": "The Kirby 3 core", + "keywords": [ + "kirby", + "cms", + "core" + ], + "homepage": "https://getkirby.com", + "version": "3.5.1", + "license": "proprietary", "authors": [ { "name": "Kirby Team", @@ -13,42 +17,61 @@ "homepage": "https://getkirby.com" } ], + "require": { + "php": ">=7.3.0 <8.1.0", + "ext-ctype": "*", + "ext-mbstring": "*", + "claviska/simpleimage": "3.5.1", + "filp/whoops": "2.9.1", + "getkirby/composer-installer": "^1.2.0", + "laminas/laminas-escaper": "2.7.0", + "michelf/php-smartypants": "1.8.1", + "mustangostang/spyc": "0.6.3", + "phpmailer/phpmailer": "6.2.0", + "true/punycode": "2.1.1" + }, + "config": { + "optimize-autoloader": true, + "platform-check": false + }, + "autoload": { + "psr-4": { + "Kirby\\": "src/" + }, + "classmap": [ + "dependencies/" + ], + "files": [ + "config/setup.php", + "config/helpers.php" + ] + }, + "scripts": { + "post-update-cmd": "curl -o cacert.pem https://curl.haxx.se/ca/cacert.pem", + "analyze": [ + "@analyze:composer", + "@analyze:psalm", + "@analyze:phpcpd", + "@analyze:phpmd" + ], + "analyze:composer": "composer validate --strict --no-check-version --no-check-all", + "analyze:phpcpd": "phpcpd --fuzzy --exclude tests --exclude vendor .", + "analyze:phpmd": "phpmd . ansi phpmd.xml.dist --exclude 'dependencies/*,tests/*,vendor/*'", + "analyze:psalm": "psalm", + "build": "./scripts/build", + "ci": [ + "@fix", + "@analyze", + "@test" + ], + "fix": "php-cs-fixer fix --config .php_cs", + "test": "phpunit --stderr --coverage-html=tests/coverage", + "zip": "composer archive --format=zip --file=dist" + }, "support": { "email": "support@getkirby.com", "issues": "https://github.com/getkirby/kirby/issues", "forum": "https://forum.getkirby.com", "source": "https://github.com/getkirby/kirby" - }, - "require": { - "php": ">=7.3.0 <8.1.0", - "ext-mbstring": "*", - "ext-ctype": "*", - "getkirby/composer-installer": "^1.2.0", - "mustangostang/spyc": "0.6.3", - "michelf/php-smartypants": "1.8.1", - "claviska/simpleimage": "3.5.1", - "phpmailer/phpmailer": "6.2.0", - "filp/whoops": "2.9.1", - "true/punycode": "2.1.1", - "laminas/laminas-escaper": "2.7.0" - }, - "autoload": { - "files": ["config/setup.php"], - "classmap": ["dependencies/"], - "psr-4": { - "Kirby\\": "src/" - } - }, - "scripts": { - "analyze": "phpstan analyse", - "build": "./scripts/build", - "fix": "php-cs-fixer fix --config .php_cs", - "post-update-cmd": "curl -o cacert.pem https://curl.haxx.se/ca/cacert.pem", - "test": "phpunit --stderr --coverage-html=tests/coverage", - "zip": "composer archive --format=zip --file=dist" - }, - "config": { - "optimize-autoloader": true, - "platform-check": false } } diff --git a/kirby/composer.lock b/kirby/composer.lock index f575fc0..3cd5be8 100755 --- a/kirby/composer.lock +++ b/kirby/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1ec5fdc421a405fb7b885ff3ed7cc137", + "content-hash": "0960cd0d8666490230ea33ff2557c4ac", "packages": [ { "name": "claviska/simpleimage", @@ -122,24 +122,23 @@ }, { "name": "getkirby/composer-installer", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/getkirby/composer-installer.git", - "reference": "240a8b2c275d61b66601feb58222b7d34bc6cf1e" + "reference": "c98ece30bfba45be7ce457e1102d1b169d922f3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getkirby/composer-installer/zipball/240a8b2c275d61b66601feb58222b7d34bc6cf1e", - "reference": "240a8b2c275d61b66601feb58222b7d34bc6cf1e", + "url": "https://api.github.com/repos/getkirby/composer-installer/zipball/c98ece30bfba45be7ce457e1102d1b169d922f3d", + "reference": "c98ece30bfba45be7ce457e1102d1b169d922f3d", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0" }, "require-dev": { - "composer/composer": "^1.8 || 2.0.*@dev", - "phpunit/phpunit": "^7.0" + "composer/composer": "^1.8 || ^2.0" }, "type": "composer-plugin", "extra": { @@ -158,9 +157,15 @@ "homepage": "https://getkirby.com", "support": { "issues": "https://github.com/getkirby/composer-installer/issues", - "source": "https://github.com/getkirby/composer-installer/tree/1.2.0" + "source": "https://github.com/getkirby/composer-installer/tree/1.2.1" }, - "time": "2020-09-13T14:43:34+00:00" + "funding": [ + { + "url": "https://getkirby.com/buy", + "type": "custom" + } + ], + "time": "2020-12-28T12:54:39+00:00" }, { "name": "laminas/laminas-escaper", @@ -575,16 +580,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531" + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531", - "reference": "39d483bdf39be819deabf04ec872eb0b2410b531", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", + "reference": "f377a3dd1fde44d37b9831d68dc8dea3ffd28e13", "shasum": "" }, "require": { @@ -596,7 +601,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -635,7 +640,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.20.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.0" }, "funding": [ { @@ -651,7 +656,7 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "true/punycode", @@ -712,8 +717,8 @@ "prefer-lowest": false, "platform": { "php": ">=7.3.0 <8.1.0", - "ext-mbstring": "*", - "ext-ctype": "*" + "ext-ctype": "*", + "ext-mbstring": "*" }, "platform-dev": [], "plugin-api-version": "2.0.0" diff --git a/kirby/config/api/models/System.php b/kirby/config/api/models/System.php index 8f8ee1a..a162ce4 100755 --- a/kirby/config/api/models/System.php +++ b/kirby/config/api/models/System.php @@ -11,8 +11,11 @@ return [ 'ascii' => function () { return Str::$ascii; }, + 'authStatus' => function () { + return $this->kirby()->auth()->status()->toArray(); + }, 'defaultLanguage' => function () { - return $this->kirby()->option('panel.language', 'en'); + return $this->kirby()->panelLanguage(); }, 'isOk' => function (System $system) { return $system->isOk(); @@ -35,21 +38,17 @@ return [ 'license' => function (System $system) { return $system->license(); }, + 'locales' => function () { + $locales = []; + $translations = $this->kirby()->translations(); + foreach ($translations as $translation) { + $locales[$translation->code()] = $translation->locale(); + } + return $locales; + }, 'loginMethods' => function (System $system) { return array_keys($system->loginMethods()); }, - 'pendingChallenge' => function () { - if ($this->session()->get('kirby.challenge.email') === null) { - return null; - } - - // fake the email challenge if no challenge was created - // to avoid leaking whether the user exists - return $this->session()->get('kirby.challenge.type', 'email'); - }, - 'pendingEmail' => function () { - return $this->session()->get('kirby.challenge.email'); - }, 'requirements' => function (System $system) { return $system->toArray(); }, @@ -70,7 +69,7 @@ return [ if ($user = $this->user()) { $translationCode = $user->language(); } else { - $translationCode = $this->kirby()->option('panel.language', 'en'); + $translationCode = $this->kirby()->panelLanguage(); } if ($translation = $this->kirby()->translation($translationCode)) { @@ -98,12 +97,11 @@ return [ 'type' => 'Kirby\Cms\System', 'views' => [ 'login' => [ + 'authStatus', 'isOk', 'isInstallable', 'isInstalled', 'loginMethods', - 'pendingChallenge', - 'pendingEmail', 'title', 'translation' ], @@ -124,6 +122,7 @@ return [ 'kirbytext', 'languages', 'license', + 'locales', 'multilang', 'requirements', 'site', diff --git a/kirby/config/api/routes/auth.php b/kirby/config/api/routes/auth.php index 535e9e1..19f45a5 100755 --- a/kirby/config/api/routes/auth.php +++ b/kirby/config/api/routes/auth.php @@ -65,7 +65,7 @@ return [ isset($methods['password']['2fa']) === true && $methods['password']['2fa'] === true ) { - $challenge = $auth->login2fa($email, $password, $long); + $status = $auth->login2fa($email, $password, $long); } else { $user = $auth->login($email, $password, $long); } @@ -78,7 +78,7 @@ return [ throw new InvalidArgumentException('Login without password is not enabled'); } - $challenge = $auth->createChallenge($email, $long, $mode); + $status = $auth->createChallenge($email, $long, $mode); } if (isset($user)) { @@ -89,11 +89,9 @@ return [ ]; } else { return [ - 'code' => 200, - 'status' => 'ok', - - // don't leak users that don't exist at this point - 'challenge' => $challenge ?? 'email' + 'code' => 200, + 'status' => 'ok', + 'challenge' => $status->challenge() ]; } } diff --git a/kirby/config/blocks/code/code.php b/kirby/config/blocks/code/code.php index f89dfff..a7f88ff 100755 --- a/kirby/config/blocks/code/code.php +++ b/kirby/config/blocks/code/code.php @@ -1 +1,2 @@ +
code()->html(false) ?>
diff --git a/kirby/config/blocks/gallery/gallery.php b/kirby/config/blocks/gallery/gallery.php index 67d535a..77ab465 100755 --- a/kirby/config/blocks/gallery/gallery.php +++ b/kirby/config/blocks/gallery/gallery.php @@ -1,3 +1,4 @@ +