diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-04-09 08:12:21 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-04-19 10:24:26 +0200 |
commit | 22dc27810eb5e30adddbf126505e7b9f7842f7d6 (patch) | |
tree | cb0cf21401eb1750bd1298632c13b31675dcd324 /core/Middleware | |
parent | fc560d8ec986402587ae506bbff58e242eb269f7 (diff) | |
download | nextcloud-server-22dc27810eb5e30adddbf126505e7b9f7842f7d6.tar.gz nextcloud-server-22dc27810eb5e30adddbf126505e7b9f7842f7d6.zip |
fix(auth): Keep redirect URL during 2FA setup and challenge
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Middleware')
-rw-r--r-- | core/Middleware/TwoFactorMiddleware.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index 4b5618eb23d..682df1312d6 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -134,8 +134,10 @@ class TwoFactorMiddleware extends Middleware { public function afterException($controller, $methodName, Exception $exception) { if ($exception instanceof TwoFactorAuthRequiredException) { - $params = []; - if (isset($this->request->server['REQUEST_URI'])) { + $params = [ + 'redirect_url' => $this->request->getParam('redirect_url'), + ]; + if (!isset($params['redirect_url']) && isset($this->request->server['REQUEST_URI'])) { $params['redirect_url'] = $this->request->server['REQUEST_URI']; } return new RedirectResponse($this->urlGenerator->linkToRoute('core.TwoFactorChallenge.selectChallenge', $params)); |