From c4d90bfcd3eaf42e36b02c9e17854ac00dfe080b Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 7 Apr 2021 11:47:05 +0300 Subject: [PATCH 1/3] Fixed missing `admin-preset.css` in multisite environments --- CHANGELOG.md | 6 ++++++ themes/grav/templates/partials/stylesheets.html.twig | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c7d0d9cc..05f0be511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.10.10 +## mm/dd/2021 + +1. [](#bugfix) + * Fixed missing `admin-preset.css` in multisite environments + # v1.10.9 ## 04/06/2021 diff --git a/themes/grav/templates/partials/stylesheets.html.twig b/themes/grav/templates/partials/stylesheets.html.twig index d684562d3..a3153c97b 100644 --- a/themes/grav/templates/partials/stylesheets.html.twig +++ b/themes/grav/templates/partials/stylesheets.html.twig @@ -1,6 +1,6 @@ {% do assets.addCss(theme_url~'/css-compiled/nucleus.css', {priority: 20}) %} {% do assets.addCss(theme_url~'/css-compiled/template.css', {priority: 20}) %} -{% do assets.addCss(base_url_frontend~'/assets/admin-preset.css', {priority: 5}) %} +{% do assets.addCss('asset://admin-preset.css', {priority: 5}) %} {% do assets.addCss(theme_url~'/css-compiled/simple-fonts.css') %} {% do assets.addCss(theme_url~'/css/fork-awesome.min.css') %} {% do assets.addCss(theme_url~'/css/chartist.min.css') %} @@ -13,4 +13,4 @@ {% endif %} {% if language_codes.rtl(grav.user.language) %} {% do assets.addCss(theme_url~'/css/rtl.css') %} -{% endif %} \ No newline at end of file +{% endif %} From 9fca08ab43365a08ede0310d8a8bcc9424d16d66 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 7 Apr 2021 14:14:04 +0300 Subject: [PATCH 2/3] Regression: Fixed broken 2FA form [#2109] --- CHANGELOG.md | 1 + admin.php | 9 ++++----- classes/plugin/Controllers/Login/LoginController.php | 11 ++++++++--- themes/grav/templates/partials/login-form.html.twig | 2 -- themes/grav/templates/partials/login-twofa.html.twig | 2 -- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f0be511..6c4d783d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 1. [](#bugfix) * Fixed missing `admin-preset.css` in multisite environments + * Regression: Fixed broken 2FA form [#2109](https://github.com/getgrav/grav-plugin-admin/issues/2109) # v1.10.9 ## 04/06/2021 diff --git a/admin.php b/admin.php index 78260d25c..e58f3a238 100644 --- a/admin.php +++ b/admin.php @@ -34,7 +34,6 @@ use Grav\Plugin\Admin\AdminController; use Grav\Plugin\Admin\Twig\AdminTwigExtension; use Grav\Plugin\Admin\WhiteLabel; -use Grav\Plugin\FlexObjects\FlexFormFactory; use Grav\Plugin\Form\Form; use Grav\Plugin\Form\Forms; use Grav\Plugin\Login\Login; @@ -684,10 +683,10 @@ public function onTwigSiteVariables() $twig->twig_vars['forms'] = $forms; // preserve form validation - if (!isset($twig->twig_vars['form'])) { - if ($this->admin->form) { - $twig->twig_vars['form'] = $this->admin->form; - } elseif (isset($header->form)) { + if ($this->admin->form) { + $twig->twig_vars['form'] = $this->admin->form; + } elseif (!isset($twig->twig_vars['form'])) { + if (isset($header->form)) { $twig->twig_vars['form'] = new Form($page); } elseif (isset($header->forms)) { $twig->twig_vars['form'] = new Form($page, null, reset($header->forms)); diff --git a/classes/plugin/Controllers/Login/LoginController.php b/classes/plugin/Controllers/Login/LoginController.php index c625f3242..240a93379 100644 --- a/classes/plugin/Controllers/Login/LoginController.php +++ b/classes/plugin/Controllers/Login/LoginController.php @@ -250,21 +250,26 @@ public function taskTwofa(): ResponseInterface return $this->createRedirectResponse('/'); } + $login = $this->getLogin(); + $this->page = $this->createPage('login'); - $this->form = $this->getForm('admin-login-twofa'); + $this->form = $this->getForm('login-twofa'); try { $this->checkNonce(); } catch (PageExpiredException $e) { $this->setMessage($this->translate('PLUGIN_ADMIN.INVALID_SECURITY_TOKEN'), 'error'); - return $this->createDisplayResponse(); + // Failed 2FA nonce check, logout and redirect. + $login->logout(['admin' => true]); + $this->form->reset(); + + return $this->createRedirectResponse('/'); } $post = $this->getPost(); $data = $post['data'] ?? []; - $login = $this->getLogin(); try { $twoFa = $login->twoFactorAuth(); } catch (TwoFactorAuthException $e) { diff --git a/themes/grav/templates/partials/login-form.html.twig b/themes/grav/templates/partials/login-form.html.twig index 8010767a9..99234030c 100755 --- a/themes/grav/templates/partials/login-form.html.twig +++ b/themes/grav/templates/partials/login-form.html.twig @@ -10,8 +10,6 @@ {% endblock %} {% block form %} - {% set form = forms['login'] %} - {% for field_name,field in form.fields %} {% if field.type %} {% set field = field|merge({ name: field.name ?? field_name }) %} diff --git a/themes/grav/templates/partials/login-twofa.html.twig b/themes/grav/templates/partials/login-twofa.html.twig index ada829f6d..7cb7892f7 100644 --- a/themes/grav/templates/partials/login-twofa.html.twig +++ b/themes/grav/templates/partials/login-twofa.html.twig @@ -5,8 +5,6 @@ {% block form %} - {% set form = forms['login-twofa'] %} - {% for field_name, field in form.fields %} {% if field.type %} {% set field = field|merge({ name: field.name ?? field_name }) %} From 6afa24b99d2e3640f38433efc00ab7242b562ab8 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 7 Apr 2021 10:50:35 -0600 Subject: [PATCH 3/3] Prepare for release --- CHANGELOG.md | 2 +- blueprints.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c4d783d3..8e6841a1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # v1.10.10 -## mm/dd/2021 +## 04/07/2021 1. [](#bugfix) * Fixed missing `admin-preset.css` in multisite environments diff --git a/blueprints.yaml b/blueprints.yaml index 25696c837..2d761acc0 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,7 +1,7 @@ name: Admin Panel slug: admin type: plugin -version: 1.10.9 +version: 1.10.10 description: Adds an advanced administration panel to manage your site icon: empire author: