summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Chan <plus.vincchan@gmail.com>2016-02-10 15:28:14 +0100
committerVincent Chan <plus.vincchan@gmail.com>2016-02-10 15:28:14 +0100
commit06b2f11e57ca893e963bfac8a0b051f4aa88a1ce (patch)
tree4fff3fc6a43f87447a938433119e96e14487e0fd
parente7859f705c7128e3af15dbde5438c782065ac874 (diff)
downloadnextcloud-server-06b2f11e57ca893e963bfac8a0b051f4aa88a1ce.tar.gz
nextcloud-server-06b2f11e57ca893e963bfac8a0b051f4aa88a1ce.zip
refactoring code
-rw-r--r--core/js/login.js5
-rw-r--r--core/templates/login.php7
-rw-r--r--lib/private/util.php1
3 files changed, 4 insertions, 9 deletions
diff --git a/core/js/login.js b/core/js/login.js
index 186b21423f3..33ec868cb23 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 590b035bce3..a12008295c4 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -67,13 +67,12 @@ script('core', [
<?php } ?>
<?php if ($_['rememberLoginAllowed'] === true) : ?>
<div class="remember-login-container">
+ <?php if ($_['rememberLoginState'] === 0) { ?>
<input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white">
- <?php if ($_POST['remember_login'] !== '1') { ?>
- <label for="remember_login">
<?php } else { ?>
- <label previously="checked" for="remember_login">
+ <input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white" checked="checked">
<?php } ?>
- <?php p($l->t('Stay logged in')); ?></label>
+ <label for="remember_login"><?php p($l->t('Stay logged in')); ?></label>
</div>
<?php endif; ?>
<input type="hidden" name="timezone-offset" id="timezone-offset"/>
diff --git a/lib/private/util.php b/lib/private/util.php
index 6e15d742bed..6ad668dedaa 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);
}