From e7859f705c7128e3af15dbde5438c782065ac874 Mon Sep 17 00:00:00 2001 From: Vincent Chan Date: Wed, 10 Feb 2016 12:37:38 +0100 Subject: [PATCH 1/2] Remember previous state of remember login checkbox fixes #22205 --- core/js/login.js | 5 +++++ core/templates/login.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/js/login.js b/core/js/login.js index 33ec868cb2..186b21423f 100644 --- a/core/js/login.js +++ b/core/js/login.js @@ -21,4 +21,9 @@ OC.Login = _.extend(OC.Login || {}, { }); $(document).ready(function() { $('form[name=login]').submit(OC.Login.onLogin); + + //set previous state of remember login checkbox + if($('label[for="remember_login"]').attr('previously') === 'checked'){ + $('#remember_login').prop('checked', true); + } }); diff --git a/core/templates/login.php b/core/templates/login.php index e87b871c67..590b035bce 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -68,7 +68,12 @@ script('core', [
- + +
From 06b2f11e57ca893e963bfac8a0b051f4aa88a1ce Mon Sep 17 00:00:00 2001 From: Vincent Chan Date: Wed, 10 Feb 2016 15:28:14 +0100 Subject: [PATCH 2/2] refactoring code --- core/js/login.js | 5 ----- core/templates/login.php | 7 +++---- lib/private/util.php | 1 + 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/core/js/login.js b/core/js/login.js index 186b21423f..33ec868cb2 100644 --- a/core/js/login.js +++ b/core/js/login.js @@ -21,9 +21,4 @@ OC.Login = _.extend(OC.Login || {}, { }); $(document).ready(function() { $('form[name=login]').submit(OC.Login.onLogin); - - //set previous state of remember login checkbox - if($('label[for="remember_login"]').attr('previously') === 'checked'){ - $('#remember_login').prop('checked', true); - } }); diff --git a/core/templates/login.php b/core/templates/login.php index 590b035bce..a12008295c 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -67,13 +67,12 @@ script('core', [ diff --git a/lib/private/util.php b/lib/private/util.php index 6e15d742be..6ad668deda 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -969,6 +969,7 @@ class OC_Util { $parameters['alt_login'] = OC_App::getAlternativeLogIns(); $parameters['rememberLoginAllowed'] = self::rememberLoginAllowed(); + $parameters['rememberLoginState'] = isset($_POST['remember_login']) ? $_POST['remember_login'] : 0; \OC_Hook::emit('OC_Util', 'pre_displayLoginPage', array('parameters' => $parameters)); OC_Template::printGuestPage("", "login", $parameters); }