Skip to content

Commit

Permalink
Merge branch 'release/1.10.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 7, 2021
2 parents f5d1780 + 6afa24b commit 8ba0d7b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v1.10.10
## 04/07/2021

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

Expand Down
9 changes: 4 additions & 5 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 8 additions & 3 deletions classes/plugin/Controllers/Login/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions themes/grav/templates/partials/login-form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) %}
Expand Down
2 changes: 0 additions & 2 deletions themes/grav/templates/partials/login-twofa.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) %}
Expand Down
4 changes: 2 additions & 2 deletions themes/grav/templates/partials/stylesheets.html.twig
Original file line number Diff line number Diff line change
@@ -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') %}
Expand All @@ -13,4 +13,4 @@
{% endif %}
{% if language_codes.rtl(grav.user.language) %}
{% do assets.addCss(theme_url~'/css/rtl.css') %}
{% endif %}
{% endif %}

0 comments on commit 8ba0d7b

Please sign in to comment.