Fix admin login redirects for multisite setups

This commit is contained in:
Matias Griese
2018-05-23 09:27:26 +03:00
parent 15f4ae8b11
commit d07d07e30f
4 changed files with 6 additions and 7 deletions

View File

@@ -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

View File

@@ -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) {

View File

@@ -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>

View File

@@ -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">