Skip to content

Commit cf9d485

Browse files
juliusknorrpabzm
authored andcommitted
fix: Add direct parameter to flow auth v2
Signed-off-by: Julius Härtl <jus@bitgrid.net> [skip ci]
1 parent 97135ee commit cf9d485

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

core/Controller/ClientFlowLoginV2Controller.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,15 @@ public function poll(string $token): JSONResponse {
100100
* @PublicPage
101101
*/
102102
#[UseSession]
103-
public function landing(string $token, $user = ''): Response {
103+
public function landing(string $token, $user = '', int $direct = 0): Response {
104104
if (!$this->loginFlowV2Service->startLoginFlow($token)) {
105105
return $this->loginTokenForbiddenResponse();
106106
}
107107

108108
$this->session->set(self::TOKEN_NAME, $token);
109109

110110
return new RedirectResponse(
111-
$this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user])
111+
$this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user, 'direct' => $direct])
112112
);
113113
}
114114

@@ -117,7 +117,7 @@ public function landing(string $token, $user = ''): Response {
117117
* @PublicPage
118118
*/
119119
#[UseSession]
120-
public function showAuthPickerPage($user = ''): StandaloneTemplateResponse {
120+
public function showAuthPickerPage(string $user = '', int $direct = 0): StandaloneTemplateResponse {
121121
try {
122122
$flow = $this->getFlowByLoginToken();
123123
} catch (LoginFlowV2NotFoundException $e) {
@@ -139,6 +139,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse {
139139
'urlGenerator' => $this->urlGenerator,
140140
'stateToken' => $stateToken,
141141
'user' => $user,
142+
'direct' => $direct,
142143
],
143144
'guest'
144145
);
@@ -150,7 +151,7 @@ public function showAuthPickerPage($user = ''): StandaloneTemplateResponse {
150151
* @NoSameSiteCookieRequired
151152
*/
152153
#[UseSession]
153-
public function grantPage(?string $stateToken): StandaloneTemplateResponse {
154+
public function grantPage(?string $stateToken, int $direct = 0): StandaloneTemplateResponse {
154155
if ($stateToken === null) {
155156
return $this->stateTokenMissingResponse();
156157
}
@@ -177,6 +178,7 @@ public function grantPage(?string $stateToken): StandaloneTemplateResponse {
177178
'instanceName' => $this->defaults->getName(),
178179
'urlGenerator' => $this->urlGenerator,
179180
'stateToken' => $stateToken,
181+
'direct' => $direct,
180182
],
181183
'guest'
182184
);

core/templates/loginflowv2/authpicker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<br/>
4747

4848
<p id="redirect-link">
49-
<form id="login-form" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user']])) ?>" method="get">
49+
<form id="login-form" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user'], 'direct' => $_['direct'] ?? 0])) ?>" method="get">
5050
<input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>" disabled>
5151
</form>
5252
</p>

core/templates/loginflowv2/grant.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
<form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.generateAppPassword')) ?>">
4949
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
5050
<input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
51+
<?php if ($_['direct']) { ?>
52+
<input type="hidden" name="direct" value="1" />
53+
<?php } ?>
5154
<div id="submit-wrapper">
5255
<input type="submit" class="login primary icon-confirm-white" title="" value="<?php p($l->t('Grant access')); ?>" />
5356
</div>

0 commit comments

Comments
 (0)