aboutsummaryrefslogtreecommitdiffstats
path: root/core/Middleware
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-04-09 08:12:21 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-04-19 10:24:26 +0200
commit22dc27810eb5e30adddbf126505e7b9f7842f7d6 (patch)
treecb0cf21401eb1750bd1298632c13b31675dcd324 /core/Middleware
parentfc560d8ec986402587ae506bbff58e242eb269f7 (diff)
downloadnextcloud-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.php6
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));