diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-09-05 17:33:15 +0200 |
---|---|---|
committer | Michael Göhler <somebody.here@gmx.de> | 2012-10-14 22:36:25 +0200 |
commit | 4b799a69824f9f4a2ddb7df382b305b304b7d754 (patch) | |
tree | 5249cf3a249976c5192acdc8a260f42e67a8b5df | |
parent | 7f3e0b5566b8c3e54cb97d186da6d398f58f8b15 (diff) | |
download | nextcloud-server-4b799a69824f9f4a2ddb7df382b305b304b7d754.tar.gz nextcloud-server-4b799a69824f9f4a2ddb7df382b305b304b7d754.zip |
Make the lifetime of the remember login cookie
-rw-r--r-- | config/config.sample.php | 5 | ||||
-rw-r--r-- | lib/base.php | 2 | ||||
-rw-r--r-- | lib/user.php | 7 |
3 files changed, 9 insertions, 5 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 09eb6053c24..0c685945904 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -86,6 +86,9 @@ $CONFIG = array( /* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */ "loglevel" => "", +/* Lifetime of the remember login cookie, default is 15 days */ +"remember_login_cookie_lifetime" => 60*60*24*15, + /* The directory where the user data is stored, default to data in the owncloud * directory. The sqlite database is also stored here, when sqlite is used. */ @@ -104,4 +107,4 @@ $CONFIG = array( 'writable' => true, ), ), -);
\ No newline at end of file +); diff --git a/lib/base.php b/lib/base.php index 78f1f85f745..be93cb40e7c 100644 --- a/lib/base.php +++ b/lib/base.php @@ -512,7 +512,7 @@ class OC{ } protected static function cleanupLoginTokens($user) { - $cutoff = time() - 60*60*24*15; + $cutoff = time() - OC_Config::getValue('remember_login_cookie_lifetime', 60*60*24*15); $tokens = OC_Preferences::getKeys($_COOKIE['oc_username'], 'login_token'); foreach($tokens as $token) { $time = OC_Preferences::getValue($user, 'login_token', $token); diff --git a/lib/user.php b/lib/user.php index 7de2a4b7fe6..be8ddce88bb 100644 --- a/lib/user.php +++ b/lib/user.php @@ -472,9 +472,10 @@ class OC_User { */ public static function setMagicInCookie($username, $token) { $secure_cookie = OC_Config::getValue("forcessl", false); - setcookie("oc_username", $username, time()+60*60*24*15, '', '', $secure_cookie); - setcookie("oc_token", $token, time()+60*60*24*15, '', '', $secure_cookie); - setcookie("oc_remember_login", true, time()+60*60*24*15, '', '', $secure_cookie); + $expires = time() + OC_Config::getValue('remember_login_cookie_lifetime', 60*60*24*15); + setcookie("oc_username", $username, $expires, '', '', $secure_cookie); + setcookie("oc_token", $token, $expires, '', '', $secure_cookie); + setcookie("oc_remember_login", true, $expires, '', '', $secure_cookie); } /** |