mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-03 11:55:52 +01:00
Fix admin login redirects for multisite setups
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
* Controls for `list` field were not in sync between top and bottom
|
* Controls for `list` field were not in sync between top and bottom
|
||||||
1. [](#bugfix)
|
1. [](#bugfix)
|
||||||
* Check if `$object->blueprints()` exists in `onAdminAfterSave`
|
* Check if `$object->blueprints()` exists in `onAdminAfterSave`
|
||||||
|
* Fix admin login redirects for multisite setups
|
||||||
|
|
||||||
# v1.8.1
|
# v1.8.1
|
||||||
## 05/15/2018
|
## 05/15/2018
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ class Admin
|
|||||||
|
|
||||||
$userKey = isset($credentials['username']) ? (string)$credentials['username'] : '';
|
$userKey = isset($credentials['username']) ? (string)$credentials['username'] : '';
|
||||||
$ipKey = Uri::ip();
|
$ipKey = Uri::ip();
|
||||||
$redirect = isset($post['redirect']) ? $post['redirect'] : $this->uri->route();
|
$redirect = $this->base . $this->route;
|
||||||
|
|
||||||
// Check if the current IP has been used in failed login attempts.
|
// Check if the current IP has been used in failed login attempts.
|
||||||
$attempts = count($rateLimiter->getAttempts($ipKey, 'ip'));
|
$attempts = count($rateLimiter->getAttempts($ipKey, 'ip'));
|
||||||
@@ -392,11 +392,9 @@ class Admin
|
|||||||
if ($user->authorized) {
|
if ($user->authorized) {
|
||||||
$event->defMessage('PLUGIN_ADMIN.LOGIN_LOGGED_IN', 'info');
|
$event->defMessage('PLUGIN_ADMIN.LOGIN_LOGGED_IN', 'info');
|
||||||
|
|
||||||
$event->defRedirect($redirect);
|
$event->defRedirect(isset($post['redirect']) ? $post['redirect'] : $redirect);
|
||||||
} else {
|
} else {
|
||||||
$this->session->redirect = $redirect;
|
$this->session->redirect = $redirect;
|
||||||
|
|
||||||
$event->defRedirect($this->uri->route());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($user->authorized) {
|
if ($user->authorized) {
|
||||||
@@ -406,7 +404,7 @@ class Admin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$event->defRedirect($this->uri->route());
|
$event->defRedirect($redirect);
|
||||||
|
|
||||||
$message = $event->getMessage();
|
$message = $event->getMessage();
|
||||||
if ($message) {
|
if ($message) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{% if authorize(['admin.pages', 'admin.super']) %}
|
{% if authorize(['admin.pages', 'admin.super']) %}
|
||||||
<div id="latest">
|
<div id="latest">
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
<a class="button" href="{{ uri.route(true) }}/pages"><i class="fa fa-fw fa-file-text-o"></i>{{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}</a>
|
<a class="button" href="{{ base_url_relative }}/pages"><i class="fa fa-fw fa-file-text-o"></i>{{ "PLUGIN_ADMIN.MANAGE_PAGES"|tu }}</a>
|
||||||
</div>
|
</div>
|
||||||
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
<h1>{{ "PLUGIN_ADMIN.LATEST_PAGE_UPDATES"|tu }}</h1>
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
{% block integration %}{% endblock %}
|
{% block integration %}{% endblock %}
|
||||||
|
|
||||||
{% set redirect = redirect ?: uri.route(false) %}
|
{% set redirect = redirect ?: '/' ~ admin_route ~ '/' ~ admin.route %}
|
||||||
|
|
||||||
<form method="post" action="{{ base_url_relative }}">
|
<form method="post" action="{{ base_url_relative }}">
|
||||||
<div class="padding">
|
<div class="padding">
|
||||||
|
|||||||
Reference in New Issue
Block a user