mirror of
https://github.com/nextcloud/server.git
synced 2024-09-08 06:43:02 +02:00
Hide stay logged in checkbox when flow authentication is used
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
08cbfb6c6b
commit
f5f6ed664d
@ -179,6 +179,7 @@ class LoginController extends Controller {
|
||||
|
||||
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
|
||||
$parameters['rememberLoginState'] = !empty($remember_login) ? $remember_login : 0;
|
||||
$parameters['hideRemeberLoginState'] = !empty($redirect_url) && $this->session->exists('client.flow.state.token');
|
||||
|
||||
if (!is_null($user) && $user !== '') {
|
||||
$parameters['loginName'] = $user;
|
||||
|
@ -70,6 +70,7 @@ script('core', 'merged-login');
|
||||
<?php } ?>
|
||||
|
||||
<div class="login-additional">
|
||||
<?php if (!$_['hideRemeberLoginState']) { ?>
|
||||
<div class="remember-login-container">
|
||||
<?php if ($_['rememberLoginState'] === 0) { ?>
|
||||
<input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white">
|
||||
@ -78,6 +79,7 @@ script('core', 'merged-login');
|
||||
<?php } ?>
|
||||
<label for="remember_login"><?php p($l->t('Stay logged in')); ?></label>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($_['canResetPassword'])) { ?>
|
||||
<div class="lost-password-container">
|
||||
<a id="lost-password" href="<?php p($_['resetPasswordLink']); ?>">
|
||||
|
@ -182,12 +182,43 @@ class LoginControllerTest extends TestCase {
|
||||
'alt_login' => [],
|
||||
'rememberLoginState' => 0,
|
||||
'resetPasswordLink' => null,
|
||||
'hideRemeberLoginState' => false,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', ''));
|
||||
}
|
||||
|
||||
public function testShowLoginFormForFlowAuth() {
|
||||
$this->userSession
|
||||
->expects($this->once())
|
||||
->method('isLoggedIn')
|
||||
->willReturn(false);
|
||||
$this->session
|
||||
->expects($this->once())
|
||||
->method('exists')
|
||||
->with('client.flow.state.token')
|
||||
->willReturn(true);
|
||||
|
||||
$expectedResponse = new TemplateResponse(
|
||||
'core',
|
||||
'login',
|
||||
[
|
||||
'messages' => [],
|
||||
'redirect_url' => 'login/flow',
|
||||
'loginName' => '',
|
||||
'user_autofocus' => true,
|
||||
'canResetPassword' => true,
|
||||
'alt_login' => [],
|
||||
'rememberLoginState' => 0,
|
||||
'resetPasswordLink' => null,
|
||||
'hideRemeberLoginState' => true,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', 'login/flow', ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
@ -240,6 +271,7 @@ class LoginControllerTest extends TestCase {
|
||||
'alt_login' => [],
|
||||
'rememberLoginState' => 0,
|
||||
'resetPasswordLink' => false,
|
||||
'hideRemeberLoginState' => false,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
@ -278,6 +310,7 @@ class LoginControllerTest extends TestCase {
|
||||
'alt_login' => [],
|
||||
'rememberLoginState' => 0,
|
||||
'resetPasswordLink' => false,
|
||||
'hideRemeberLoginState' => false,
|
||||
],
|
||||
'guest'
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user