diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2024-08-07 20:54:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-07 20:54:38 +0200 |
commit | e056f5c579da3931986529bed22c0e1fd5b62759 (patch) | |
tree | db8bb6a018f7749a1263925ee5b6bfcdfe433006 | |
parent | d611843651522fcd0d9c424171f516172e6b094f (diff) | |
parent | 94fbf3e9b33a1d25855fc47dd918a5f57850084b (diff) | |
download | nextcloud-server-e056f5c579da3931986529bed22c0e1fd5b62759.tar.gz nextcloud-server-e056f5c579da3931986529bed22c0e1fd5b62759.zip |
Merge pull request #47052 from nextcloud/backport/46534/stable28
[stable28] fix: Add direct parameter to flow auth v2
-rw-r--r-- | core/Controller/ClientFlowLoginV2Controller.php | 10 | ||||
-rw-r--r-- | core/templates/loginflowv2/authpicker.php | 2 | ||||
-rw-r--r-- | 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 f5bd2d216dd..915a130193a 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -100,7 +100,7 @@ class ClientFlowLoginV2Controller extends Controller { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function landing(string $token, $user = ''): Response { + public function landing(string $token, string $user = '', int $direct = 0): Response { if (!$this->loginFlowV2Service->startLoginFlow($token)) { return $this->loginTokenForbiddenResponse(); } @@ -108,7 +108,7 @@ class ClientFlowLoginV2Controller extends Controller { $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]) ); } @@ -118,7 +118,7 @@ class ClientFlowLoginV2Controller extends Controller { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function showAuthPickerPage($user = ''): StandaloneTemplateResponse { + public function showAuthPickerPage(string $user = '', int $direct = 0): StandaloneTemplateResponse { try { $flow = $this->getFlowByLoginToken(); } catch (LoginFlowV2NotFoundException $e) { @@ -140,6 +140,7 @@ class ClientFlowLoginV2Controller extends Controller { 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, 'user' => $user, + 'direct' => $direct, ], 'guest' ); @@ -152,7 +153,7 @@ class ClientFlowLoginV2Controller extends Controller { */ #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] #[UseSession] - public function grantPage(?string $stateToken): StandaloneTemplateResponse { + public function grantPage(?string $stateToken, int $direct = 0): StandaloneTemplateResponse { if ($stateToken === null) { return $this->stateTokenMissingResponse(); } @@ -179,6 +180,7 @@ class ClientFlowLoginV2Controller extends Controller { '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 0e18cc99ce1..a3cb4be7db3 100644 --- a/core/templates/loginflowv2/authpicker.php +++ b/core/templates/loginflowv2/authpicker.php @@ -46,7 +46,7 @@ $urlGenerator = $_['urlGenerator']; <br/> <p id="redirect-link"> - <form id="login-form" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user']])) ?>" method="get"> + <form id="login-form" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user'], 'direct' => $_['direct'] ?? 0])) ?>" method="get"> <input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>" disabled> </form> </p> diff --git a/core/templates/loginflowv2/grant.php b/core/templates/loginflowv2/grant.php index 567c3b4e776..599e612010b 100644 --- a/core/templates/loginflowv2/grant.php +++ b/core/templates/loginflowv2/grant.php @@ -48,6 +48,9 @@ $urlGenerator = $_['urlGenerator']; <form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.generateAppPassword')) ?>"> <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" /> <input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" /> + <?php if ($_['direct']) { ?> + <input type="hidden" name="direct" value="1" /> + <?php } ?> <div id="submit-wrapper"> <input type="submit" class="login primary icon-confirm-white" title="" value="<?php p($l->t('Grant access')); ?>" /> </div> |