Hide stay logged in checkbox when flow authentication is used

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2017-12-21 00:25:30 +01:00 committed by Roeland Jago Douma
parent 08cbfb6c6b
commit f5f6ed664d
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 36 additions and 0 deletions

View File

@ -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;

View File

@ -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']); ?>">

View File

@ -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'
);