From 61752fa8d132af13e7121b7ecfdba13bd179d37b 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() Conflicts: core/templates/login.php lib/util.php --- core/templates/login.php | 2 +- lib/base.php | 2 +- lib/util.php | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/templates/login.php b/core/templates/login.php index 0bb0114f6de..3874e998bf9 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -35,7 +35,7 @@

- + diff --git a/lib/base.php b/lib/base.php index c9551cd2749..2ac58b259b2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -746,7 +746,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 7657b234687..4ae85c4be91 100755 --- a/lib/util.php +++ b/lib/util.php @@ -372,7 +372,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); } @@ -411,7 +411,18 @@ class OC_Util { } /** - * Check if the user is a subadmin, redirects to home if not + * 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 */ public static function checkSubAdminUser() { -- 2.39.5