diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-04-14 22:10:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 22:10:32 +0200 |
commit | 97d500043710e852a5277891f234c6b25921cf72 (patch) | |
tree | 3ce3906ca38cdb33b9e4c59f408e13407f00d450 /core | |
parent | 07249728d46debf0d3ade50a885936535e24da85 (diff) | |
parent | eed25090d94d78f321ec214ca13137e6612fde9e (diff) | |
download | nextcloud-server-97d500043710e852a5277891f234c6b25921cf72.tar.gz nextcloud-server-97d500043710e852a5277891f234c6b25921cf72.zip |
Merge pull request #31748 from nextcloud/backport/31592/stable23
[stable23] Add direct arg to login flow
Diffstat (limited to 'core')
-rw-r--r-- | core/Controller/ClientFlowLoginController.php | 17 | ||||
-rw-r--r-- | core/templates/loginflow/authpicker.php | 5 | ||||
-rw-r--r-- | core/templates/loginflow/grant.php | 15 |
3 files changed, 19 insertions, 18 deletions
diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 2ba26deb0e7..d67a065a14e 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -162,12 +162,8 @@ class ClientFlowLoginController extends Controller { * @PublicPage * @NoCSRFRequired * @UseSession - * - * @param string $clientIdentifier - * - * @return StandaloneTemplateResponse */ - public function showAuthPickerPage($clientIdentifier = '') { + public function showAuthPickerPage(string $clientIdentifier = '', int $direct = 0): StandaloneTemplateResponse { $clientName = $this->getClientName(); $client = null; if ($clientIdentifier !== '') { @@ -218,6 +214,7 @@ class ClientFlowLoginController extends Controller { 'stateToken' => $stateToken, 'serverHost' => $this->getServerPath(), 'oauthState' => $this->session->get('oauth.state'), + 'direct' => $direct, ], 'guest' ); @@ -231,13 +228,10 @@ class ClientFlowLoginController extends Controller { * @NoCSRFRequired * @NoSameSiteCookieRequired * @UseSession - * - * @param string $stateToken - * @param string $clientIdentifier - * @return StandaloneTemplateResponse */ - public function grantPage($stateToken = '', - $clientIdentifier = '') { + public function grantPage(string $stateToken = '', + string $clientIdentifier = '', + int $direct = 0): StandaloneTemplateResponse { if (!$this->isValidToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } @@ -267,6 +261,7 @@ class ClientFlowLoginController extends Controller { 'stateToken' => $stateToken, 'serverHost' => $this->getServerPath(), 'oauthState' => $this->session->get('oauth.state'), + 'direct' => $direct, ], 'guest' ); diff --git a/core/templates/loginflow/authpicker.php b/core/templates/loginflow/authpicker.php index 02b4b9cc003..4c4c8fd6d53 100644 --- a/core/templates/loginflow/authpicker.php +++ b/core/templates/loginflow/authpicker.php @@ -46,7 +46,7 @@ $urlGenerator = $_['urlGenerator']; <br/> <p id="redirect-link"> - <a href="<?php p($urlGenerator->linkToRoute('core.ClientFlowLogin.grantPage', ['stateToken' => $_['stateToken'], 'clientIdentifier' => $_['clientIdentifier'], 'oauthState' => $_['oauthState']])) ?>"> + <a href="<?php p($urlGenerator->linkToRoute('core.ClientFlowLogin.grantPage', ['stateToken' => $_['stateToken'], 'clientIdentifier' => $_['clientIdentifier'], 'oauthState' => $_['oauthState'], 'direct' => $_['direct']])) ?>"> <input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>"> </a> </p> @@ -62,6 +62,9 @@ $urlGenerator = $_['urlGenerator']; </p> <input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" /> <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>"> + <?php if ($_['direct'] !== 0) { ?> + <input type="hidden" name="direct" value="<?php p($_['direct']) ?>"> + <?php } ?> <input id="submit-app-token-login" type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Grant access')) ?>"> </form> </div> diff --git a/core/templates/loginflow/grant.php b/core/templates/loginflow/grant.php index 0f1b9235a89..c537c47ea64 100644 --- a/core/templates/loginflow/grant.php +++ b/core/templates/loginflow/grant.php @@ -39,14 +39,17 @@ $urlGenerator = $_['urlGenerator']; <br/> <p id="redirect-link"> - <form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLogin.generateAppPassword')) ?>"> - <input type="hidden" name="clientIdentifier" value="<?php p($_['clientIdentifier']) ?>" /> - <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" /> - <input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" /> - <input type="hidden" name="oauthState" value="<?php p($_['oauthState']) ?>" /> + <form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLogin.generateAppPassword')) ?>"> + <input type="hidden" name="clientIdentifier" value="<?php p($_['clientIdentifier']) ?>" /> + <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" /> + <input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" /> + <input type="hidden" name="oauthState" value="<?php p($_['oauthState']) ?>" /> + <?php if (p($_['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> + </div> </form> </p> </div> |