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['alt_login'] = OC_App::getAlternativeLogIns();
|
||||||
$parameters['rememberLoginState'] = !empty($remember_login) ? $remember_login : 0;
|
$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 !== '') {
|
if (!is_null($user) && $user !== '') {
|
||||||
$parameters['loginName'] = $user;
|
$parameters['loginName'] = $user;
|
||||||
|
|
|
@ -70,6 +70,7 @@ script('core', 'merged-login');
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<div class="login-additional">
|
<div class="login-additional">
|
||||||
|
<?php if (!$_['hideRemeberLoginState']) { ?>
|
||||||
<div class="remember-login-container">
|
<div class="remember-login-container">
|
||||||
<?php if ($_['rememberLoginState'] === 0) { ?>
|
<?php if ($_['rememberLoginState'] === 0) { ?>
|
||||||
<input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white">
|
<input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white">
|
||||||
|
@ -78,6 +79,7 @@ script('core', 'merged-login');
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<label for="remember_login"><?php p($l->t('Stay logged in')); ?></label>
|
<label for="remember_login"><?php p($l->t('Stay logged in')); ?></label>
|
||||||
</div>
|
</div>
|
||||||
|
<?php } ?>
|
||||||
<?php if (!empty($_['canResetPassword'])) { ?>
|
<?php if (!empty($_['canResetPassword'])) { ?>
|
||||||
<div class="lost-password-container">
|
<div class="lost-password-container">
|
||||||
<a id="lost-password" href="<?php p($_['resetPasswordLink']); ?>">
|
<a id="lost-password" href="<?php p($_['resetPasswordLink']); ?>">
|
||||||
|
|
|
@ -182,12 +182,43 @@ class LoginControllerTest extends TestCase {
|
||||||
'alt_login' => [],
|
'alt_login' => [],
|
||||||
'rememberLoginState' => 0,
|
'rememberLoginState' => 0,
|
||||||
'resetPasswordLink' => null,
|
'resetPasswordLink' => null,
|
||||||
|
'hideRemeberLoginState' => false,
|
||||||
],
|
],
|
||||||
'guest'
|
'guest'
|
||||||
);
|
);
|
||||||
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', '', ''));
|
$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
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -240,6 +271,7 @@ class LoginControllerTest extends TestCase {
|
||||||
'alt_login' => [],
|
'alt_login' => [],
|
||||||
'rememberLoginState' => 0,
|
'rememberLoginState' => 0,
|
||||||
'resetPasswordLink' => false,
|
'resetPasswordLink' => false,
|
||||||
|
'hideRemeberLoginState' => false,
|
||||||
],
|
],
|
||||||
'guest'
|
'guest'
|
||||||
);
|
);
|
||||||
|
@ -278,6 +310,7 @@ class LoginControllerTest extends TestCase {
|
||||||
'alt_login' => [],
|
'alt_login' => [],
|
||||||
'rememberLoginState' => 0,
|
'rememberLoginState' => 0,
|
||||||
'resetPasswordLink' => false,
|
'resetPasswordLink' => false,
|
||||||
|
'hideRemeberLoginState' => false,
|
||||||
],
|
],
|
||||||
'guest'
|
'guest'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue