aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller
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/Controller
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/Controller')
-rw-r--r--core/Controller/TwoFactorChallengeController.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php
index 7152078c338..48fd365fd12 100644
--- a/core/Controller/TwoFactorChallengeController.php
+++ b/core/Controller/TwoFactorChallengeController.php
@@ -213,13 +213,14 @@ class TwoFactorChallengeController extends Controller {
* @NoCSRFRequired
*/
#[FrontpageRoute(verb: 'GET', url: 'login/setupchallenge')]
- public function setupProviders(): StandaloneTemplateResponse {
+ public function setupProviders(?string $redirect_url = null): StandaloneTemplateResponse {
$user = $this->userSession->getUser();
$setupProviders = $this->twoFactorManager->getLoginSetupProviders($user);
$data = [
'providers' => $setupProviders,
'logout_url' => $this->getLogoutUrl(),
+ 'redirect_url' => $redirect_url,
];
return new StandaloneTemplateResponse($this->appName, 'twofactorsetupselection', $data, 'guest');
@@ -230,7 +231,7 @@ class TwoFactorChallengeController extends Controller {
* @NoCSRFRequired
*/
#[FrontpageRoute(verb: 'GET', url: 'login/setupchallenge/{providerId}')]
- public function setupProvider(string $providerId) {
+ public function setupProvider(string $providerId, ?string $redirect_url = null) {
$user = $this->userSession->getUser();
$providers = $this->twoFactorManager->getLoginSetupProviders($user);
@@ -251,6 +252,7 @@ class TwoFactorChallengeController extends Controller {
$data = [
'provider' => $provider,
'logout_url' => $this->getLogoutUrl(),
+ 'redirect_url' => $redirect_url,
'template' => $tmpl->fetchPage(),
];
$response = new StandaloneTemplateResponse($this->appName, 'twofactorsetupchallenge', $data, 'guest');
@@ -264,11 +266,12 @@ class TwoFactorChallengeController extends Controller {
* @todo handle the extreme edge case of an invalid provider ID and redirect to the provider selection page
*/
#[FrontpageRoute(verb: 'POST', url: 'login/setupchallenge/{providerId}')]
- public function confirmProviderSetup(string $providerId) {
+ public function confirmProviderSetup(string $providerId, ?string $redirect_url = null) {
return new RedirectResponse($this->urlGenerator->linkToRoute(
'core.TwoFactorChallenge.showChallenge',
[
'challengeProviderId' => $providerId,
+ 'redirect_url' => $redirect_url,
]
));
}