From c486fc76089ebc0f421a983e0ef62286e36e533c Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 24 Sep 2013 18:01:34 +0200 Subject: [PATCH] introduce OC_Util::rememberLoginAllowed() --- core/templates/login.php | 2 +- lib/base.php | 2 +- lib/util.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/templates/login.php b/core/templates/login.php index 3e736f164e..06f64d41e3 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -32,7 +32,7 @@ t('Lost your password?')); ?> - + diff --git a/lib/base.php b/lib/base.php index b4e12bc7eb..d0aed230dd 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 ef42ff2aea..e12f753d5a 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); } @@ -509,6 +509,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