Skip to content

Commit 4fd0877

Browse files
PVince81CarlSchwan
authored andcommitted
Add direct arg to login flow
Signed-off-by: Vincent Petry <[email protected]> Co-Authored-by: Carl Schwan <[email protected]>
1 parent bfdc9cc commit 4fd0877

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

core/Controller/ClientFlowLoginController.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ private function stateTokenForbiddenResponse() {
162162
* @PublicPage
163163
* @NoCSRFRequired
164164
* @UseSession
165-
*
166-
* @param string $clientIdentifier
167-
*
168-
* @return StandaloneTemplateResponse
169165
*/
170166
public function showAuthPickerPage($clientIdentifier = '') {
171167
$clientName = $this->getClientName();
@@ -231,13 +227,10 @@ public function showAuthPickerPage($clientIdentifier = '') {
231227
* @NoCSRFRequired
232228
* @NoSameSiteCookieRequired
233229
* @UseSession
234-
*
235-
* @param string $stateToken
236-
* @param string $clientIdentifier
237-
* @return StandaloneTemplateResponse
238230
*/
239-
public function grantPage($stateToken = '',
240-
$clientIdentifier = '') {
231+
public function grantPage(string $stateToken = '',
232+
string $clientIdentifier = '',
233+
int $direct = 0): StandaloneTemplateResponse {
241234
if (!$this->isValidToken($stateToken)) {
242235
return $this->stateTokenForbiddenResponse();
243236
}
@@ -267,6 +260,7 @@ public function grantPage($stateToken = '',
267260
'stateToken' => $stateToken,
268261
'serverHost' => $this->getServerPath(),
269262
'oauthState' => $this->session->get('oauth.state'),
263+
'direct' => $direct,
270264
],
271265
'guest'
272266
);

core/templates/loginflow/authpicker.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
</p>
6363
<input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
6464
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>">
65+
<?php if ($_['direct'] !== 0) { ?>
66+
<input type="hidden" name="direct" value="<?php p($_['direct']) ?>">
67+
<?php } ?>
6568
<input id="submit-app-token-login" type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Grant access')) ?>">
6669
</form>
6770
</div>

core/templates/loginflow/grant.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@
3939
<br/>
4040

4141
<p id="redirect-link">
42-
<form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLogin.generateAppPassword')) ?>">
43-
<input type="hidden" name="clientIdentifier" value="<?php p($_['clientIdentifier']) ?>" />
44-
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
45-
<input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
46-
<input type="hidden" name="oauthState" value="<?php p($_['oauthState']) ?>" />
42+
<form method="POST" action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLogin.generateAppPassword')) ?>">
43+
<input type="hidden" name="clientIdentifier" value="<?php p($_['clientIdentifier']) ?>" />
44+
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
45+
<input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
46+
<input type="hidden" name="oauthState" value="<?php p($_['oauthState']) ?>" />
47+
<?php if (p($_['direct'])) { ?>
48+
<input type="hidden" name="direct" value="1" />
49+
<?php } ?>
4750
<div id="submit-wrapper">
4851
<input type="submit" class="login primary icon-confirm-white" title="" value="<?php p($l->t('Grant access')); ?>" />
49-
</div>
52+
</div>
5053
</form>
5154
</p>
5255
</div>

0 commit comments

Comments
 (0)