]> source.dussan.org Git - nextcloud-server.git/commitdiff
introduce OC_Util::rememberLoginAllowed()
authorBjoern Schiessle <schiessle@owncloud.com>
Tue, 24 Sep 2013 16:01:34 +0000 (18:01 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Tue, 24 Sep 2013 16:01:34 +0000 (18:01 +0200)
core/templates/login.php
lib/base.php
lib/util.php

index 3e736f164ec60d7742fe7118dba9eb96e77aca09..06f64d41e39e24e5efd9490eef5215b664f17cc9 100644 (file)
@@ -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; ?>
index b4e12bc7ebbb316c8401491dcd486d8b16cbf909..d0aed230dd0ec110147258c364bd7e4c3eae29da 100644 (file)
@@ -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;
                }
index ef42ff2aea984c6784c3c315d81012472f41a8ee..e12f753d5ae05e54d584a9845bdd99f6b08f71de 100755 (executable)
@@ -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