mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 03:02:01 -04:00
Merge pull request #29530 from nextcloud/bugfix/noid/username-prefill
This commit is contained in:
commit
a37909f61c
9 changed files with 18 additions and 11 deletions
|
|
@ -167,7 +167,7 @@ class ClientFlowLoginController extends Controller {
|
|||
*
|
||||
* @return StandaloneTemplateResponse
|
||||
*/
|
||||
public function showAuthPickerPage($clientIdentifier = '') {
|
||||
public function showAuthPickerPage($clientIdentifier = '', $user = '') {
|
||||
$clientName = $this->getClientName();
|
||||
$client = null;
|
||||
if ($clientIdentifier !== '') {
|
||||
|
|
@ -218,6 +218,7 @@ class ClientFlowLoginController extends Controller {
|
|||
'stateToken' => $stateToken,
|
||||
'serverHost' => $this->getServerPath(),
|
||||
'oauthState' => $this->session->get('oauth.state'),
|
||||
'user' => $user,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class ClientFlowLoginV2Controller extends Controller {
|
|||
* @PublicPage
|
||||
* @UseSession
|
||||
*/
|
||||
public function landing(string $token): Response {
|
||||
public function landing(string $token, $user = ''): 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')
|
||||
$this->urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.showAuthPickerPage', ['user' => $user])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ class ClientFlowLoginV2Controller extends Controller {
|
|||
* @PublicPage
|
||||
* @UseSession
|
||||
*/
|
||||
public function showAuthPickerPage(): StandaloneTemplateResponse {
|
||||
public function showAuthPickerPage($user = ''): StandaloneTemplateResponse {
|
||||
try {
|
||||
$flow = $this->getFlowByLoginToken();
|
||||
} catch (LoginFlowV2NotFoundException $e) {
|
||||
|
|
@ -138,6 +138,7 @@ class ClientFlowLoginV2Controller extends Controller {
|
|||
'instanceName' => $this->defaults->getName(),
|
||||
'urlGenerator' => $this->urlGenerator,
|
||||
'stateToken' => $stateToken,
|
||||
'user' => $user,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
|
|
|
|||
4
core/js/dist/login.js
vendored
4
core/js/dist/login.js
vendored
File diff suppressed because one or more lines are too long
2
core/js/dist/login.js.map
vendored
2
core/js/dist/login.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -143,7 +143,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
user: this.username,
|
||||
user: loadState('core', 'loginUsername', ''),
|
||||
passwordlessLogin: false,
|
||||
resetPassword: false,
|
||||
|
||||
|
|
@ -151,7 +151,6 @@ export default {
|
|||
errors: loadState('core', 'loginErrors', []),
|
||||
messages: loadState('core', 'loginMessages', []),
|
||||
redirectUrl: loadState('core', 'loginRedirectUrl', false),
|
||||
username: loadState('core', 'loginUsername', ''),
|
||||
throttleDelay: loadState('core', 'loginThrottleDelay', 0),
|
||||
invertedColors: OCA.Theming && OCA.Theming.inverted,
|
||||
canResetPassword: loadState('core', 'loginCanResetPassword', false),
|
||||
|
|
|
|||
|
|
@ -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'], 'user' => $_['user']])) ?>">
|
||||
<input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>">
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ $urlGenerator = $_['urlGenerator'];
|
|||
<br/>
|
||||
|
||||
<p id="redirect-link">
|
||||
<a href="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken']])) ?>">
|
||||
<a href="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLoginV2.grantPage', ['stateToken' => $_['stateToken'], 'user' => $_['user']])) ?>">
|
||||
<input type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Log in')) ?>">
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -260,6 +260,10 @@ class SecurityMiddleware extends Middleware {
|
|||
if (isset($this->request->server['REQUEST_URI'])) {
|
||||
$params['redirect_url'] = $this->request->server['REQUEST_URI'];
|
||||
}
|
||||
$usernamePrefill = $this->request->getParam('user', '');
|
||||
if ($usernamePrefill !== '') {
|
||||
$params['user'] = $usernamePrefill;
|
||||
}
|
||||
$url = $this->urlGenerator->linkToRoute('core.login.showLoginForm', $params);
|
||||
$response = new RedirectResponse($url);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ class ClientFlowLoginControllerTest extends TestCase {
|
|||
'stateToken' => 'StateToken',
|
||||
'serverHost' => 'https://example.com',
|
||||
'oauthState' => 'OauthStateToken',
|
||||
'user' => '',
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
|
|
@ -246,6 +247,7 @@ class ClientFlowLoginControllerTest extends TestCase {
|
|||
'stateToken' => 'StateToken',
|
||||
'serverHost' => 'https://example.com',
|
||||
'oauthState' => 'OauthStateToken',
|
||||
'user' => '',
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue