diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-24 18:01:34 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-09-24 18:01:34 +0200 |
commit | c486fc76089ebc0f421a983e0ef62286e36e533c (patch) | |
tree | 42bfd3e903a3b65690548e5b1a7d23cc02e862d8 | |
parent | b693b5085c3da7a3242c1efe9251c2f579027d76 (diff) | |
download | nextcloud-server-c486fc76089ebc0f421a983e0ef62286e36e533c.tar.gz nextcloud-server-c486fc76089ebc0f421a983e0ef62286e36e533c.zip |
introduce OC_Util::rememberLoginAllowed()
-rw-r--r-- | core/templates/login.php | 2 | ||||
-rw-r--r-- | lib/base.php | 2 | ||||
-rwxr-xr-x | lib/util.php | 13 |
3 files changed, 14 insertions, 3 deletions
diff --git a/core/templates/login.php b/core/templates/login.php index 3e736f164ec..06f64d41e39 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -32,7 +32,7 @@ <?php p($l->t('Lost your password?')); ?> </a> <?php endif; ?> - <?php if ($_['encryption_enabled'] === false) : ?> + <?php if ($_['rememberLoginAllowed'] === true) : ?> <input type="checkbox" name="remember_login" value="1" id="remember_login" checked /> <label for="remember_login"><?php p($l->t('remember')); ?></label> <?php endif; ?> diff --git a/lib/base.php b/lib/base.php index b4e12bc7ebb..d0aed230dd0 100644 --- a/lib/base.php +++ b/lib/base.php @@ -760,7 +760,7 @@ class OC { || !isset($_COOKIE["oc_token"]) || !isset($_COOKIE["oc_username"]) || !$_COOKIE["oc_remember_login"] - || OC_App::isEnabled('files_encryption') + || !OC_Util::rememberLoginAllowed() ) { return false; } diff --git a/lib/util.php b/lib/util.php index ef42ff2aea9..e12f753d5ae 100755 --- a/lib/util.php +++ b/lib/util.php @@ -467,7 +467,7 @@ class OC_Util { } $parameters['alt_login'] = OC_App::getAlternativeLogIns(); - $parameters['encryption_enabled'] = OC_App::isEnabled('files_encryption'); + $parameters['rememberLoginAllowed'] = self::rememberLoginAllowed(); OC_Template::printGuestPage("", "login", $parameters); } @@ -510,6 +510,17 @@ class OC_Util { } /** + * Check if it is allowed to remember login. + * E.g. if encryption is enabled the user needs to log-in every time he visites + * ownCloud in order to decrypt the private key. + * + * @return bool + */ + public static function rememberLoginAllowed() { + return !OC_App::isEnabled('files_encryption'); + } + + /** * @brief Check if the user is a subadmin, redirects to home if not * @return array $groups where the current user is subadmin */ |