diff options
-rw-r--r-- | core/Controller/LoginController.php | 1 | ||||
-rw-r--r-- | core/templates/login.php | 2 | ||||
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 33 |
3 files changed, 36 insertions, 0 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index e87e097e423..e53095a7de7 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -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; diff --git a/core/templates/login.php b/core/templates/login.php index 82827bbef03..d28c92e36ef 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -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']); ?>"> diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index e02b8403a2a..ddf7a865d66 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -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' ); |