diff --git a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php
index 4b25e9921e404..519db00d6439d 100644
--- a/app/code/Magento/Backend/App/Action/Plugin/Authentication.php
+++ b/app/code/Magento/Backend/App/Action/Plugin/Authentication.php
@@ -225,7 +225,8 @@ protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInt
// Checks, whether secret key is required for admin access or request uri is explicitly set
if ($this->_url->useSecretKey()) {
- $requestUri = $this->_url->getUrl('*/*/*', ['_current' => true]);
+ $requestParts = explode('/', trim($request->getRequestUri(), '/'), 2);
+ $requestUri = $this->_url->getUrl(array_pop($requestParts));
} elseif ($request) {
$requestUri = $request->getRequestUri();
}
diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php
index 1de77c810f316..16be2cf1343eb 100644
--- a/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php
+++ b/app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php
@@ -49,11 +49,10 @@ public function execute()
}
$requestUrl = $this->getRequest()->getUri();
- $backendUrl = $this->getUrl('*');
- // redirect according to rewrite rule
- if ($requestUrl != $backendUrl) {
- return $this->getRedirect($backendUrl);
+ if (!$requestUrl->isValid()) {
+ return $this->getRedirect($this->getUrl('*'));
}
+
return $this->resultPageFactory->create();
}
diff --git a/app/code/Magento/Security/Test/Mftf/Test/AdminNavigateWhileUserExpiredTest.xml b/app/code/Magento/Security/Test/Mftf/Test/AdminNavigateWhileUserExpiredTest.xml
index dc88ad9d2cbf1..c7bfdd8bb9e98 100644
--- a/app/code/Magento/Security/Test/Mftf/Test/AdminNavigateWhileUserExpiredTest.xml
+++ b/app/code/Magento/Security/Test/Mftf/Test/AdminNavigateWhileUserExpiredTest.xml
@@ -48,7 +48,8 @@
-
+
+
diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Save.php b/app/code/Magento/User/Controller/Adminhtml/User/Save.php
index 521c09f7b7707..72024a85bef13 100644
--- a/app/code/Magento/User/Controller/Adminhtml/User/Save.php
+++ b/app/code/Magento/User/Controller/Adminhtml/User/Save.php
@@ -105,7 +105,7 @@ public function execute()
$this->getSecurityCookie()->setLogoutReasonCookie(
\Magento\Security\Model\AdminSessionsManager::LOGOUT_REASON_USER_LOCKED
);
- $this->_redirect('adminhtml/*/');
+ $this->_redirect('*');
} catch (NotificationExceptionInterface $exception) {
$this->messageManager->addErrorMessage($exception->getMessage());
} catch (\Magento\Framework\Exception\AuthenticationException $e) {