From 1f15850de608e1f117052c9e9094f6773c3bb6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 15 Jul 2024 15:49:32 +0200 Subject: [PATCH] fix: Add direct parameter to flow auth v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/Controller/ClientFlowLoginV2Controller.php | 10 ++++++---- core/templates/loginflowv2/authpicker.php | 2 +- core/templates/loginflowv2/grant.php | 3 +++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index ef16cfbd04bf5..fa8a268d1a8d3 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -100,7 +100,7 @@ public function poll(string $token): JSONResponse { * @PublicPage */ #[UseSession] - public function landing(string $token, $user = ''): Response { + public function landing(string $token, $user = '', int $direct = 0): Response { if (!$this->loginFlowV2Service->startLoginFlow($token)) { return $this->loginTokenForbiddenResponse(); } @@ -108,7 +108,7 @@ public function landing(string $token, $user = ''): Response { $this->session->set(self::TOKEN_NAME, $token); return new RedirectResponse( - $this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user]) + $this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user, 'direct' => $direct]) ); } @@ -117,7 +117,7 @@ public function landing(string $token, $user = ''): Response { * @PublicPage */ #[UseSession] - public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { + public function showAuthPickerPage(string $user = '', int $direct = 0): StandaloneTemplateResponse { try { $flow = $this->getFlowByLoginToken(); } catch (LoginFlowV2NotFoundException $e) { @@ -139,6 +139,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, 'user' => $user, + 'direct' => $direct, ], 'guest' ); @@ -150,7 +151,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { * @NoSameSiteCookieRequired */ #[UseSession] - public function grantPage(?string $stateToken): StandaloneTemplateResponse { + public function grantPage(?string $stateToken, int $direct = 0): StandaloneTemplateResponse { if ($stateToken === null) { return $this->stateTokenMissingResponse(); } @@ -177,6 +178,7 @@ public function grantPage(?string $stateToken): StandaloneTemplateResponse { 'instanceName' => $this->defaults->getName(), 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, + 'direct' => $direct, ], 'guest' ); diff --git a/core/templates/loginflowv2/authpicker.php b/core/templates/loginflowv2/authpicker.php index 0e18cc99ce15f..a3cb4be7db3a9 100644 --- a/core/templates/loginflowv2/authpicker.php +++ b/core/templates/loginflowv2/authpicker.php @@ -46,7 +46,7 @@
+

diff --git a/core/templates/loginflowv2/grant.php b/core/templates/loginflowv2/grant.php index 567c3b4e7760e..599e612010bf6 100644 --- a/core/templates/loginflowv2/grant.php +++ b/core/templates/loginflowv2/grant.php @@ -48,6 +48,9 @@
+ + +