summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2024-07-15 15:49:32 +0200
committerJulius Härtl <jus@bitgrid.net>2024-08-06 22:46:14 +0200
commit94fbf3e9b33a1d25855fc47dd918a5f57850084b (patch)
tree36a248f22b46c3bf65121e7160523106db4b51fe
parent1389863f42ad90be947dd15465744661b25226b4 (diff)
downloadnextcloud-server-94fbf3e9b33a1d25855fc47dd918a5f57850084b.tar.gz
nextcloud-server-94fbf3e9b33a1d25855fc47dd918a5f57850084b.zip
fix: Add direct parameter to flow auth v2
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--core/Controller/ClientFlowLoginV2Controller.php10
-rw-r--r--core/templates/loginflowv2/authpicker.php2
-rw-r--r--core/templates/loginflowv2/grant.php3
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>