Make the lifetime of the remember login cookie
This commit is contained in:
parent
7f3e0b5566
commit
4b799a6982
|
@ -86,6 +86,9 @@ $CONFIG = array(
|
||||||
/* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */
|
/* Loglevel to start logging at. 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default is WARN) */
|
||||||
"loglevel" => "",
|
"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
|
/* 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.
|
* directory. The sqlite database is also stored here, when sqlite is used.
|
||||||
*/
|
*/
|
||||||
|
@ -104,4 +107,4 @@ $CONFIG = array(
|
||||||
'writable' => true,
|
'writable' => true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -512,7 +512,7 @@ class OC{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function cleanupLoginTokens($user) {
|
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');
|
$tokens = OC_Preferences::getKeys($_COOKIE['oc_username'], 'login_token');
|
||||||
foreach($tokens as $token) {
|
foreach($tokens as $token) {
|
||||||
$time = OC_Preferences::getValue($user, 'login_token', $token);
|
$time = OC_Preferences::getValue($user, 'login_token', $token);
|
||||||
|
|
|
@ -472,9 +472,10 @@ class OC_User {
|
||||||
*/
|
*/
|
||||||
public static function setMagicInCookie($username, $token) {
|
public static function setMagicInCookie($username, $token) {
|
||||||
$secure_cookie = OC_Config::getValue("forcessl", false);
|
$secure_cookie = OC_Config::getValue("forcessl", false);
|
||||||
setcookie("oc_username", $username, time()+60*60*24*15, '', '', $secure_cookie);
|
$expires = time() + OC_Config::getValue('remember_login_cookie_lifetime', 60*60*24*15);
|
||||||
setcookie("oc_token", $token, time()+60*60*24*15, '', '', $secure_cookie);
|
setcookie("oc_username", $username, $expires, '', '', $secure_cookie);
|
||||||
setcookie("oc_remember_login", true, time()+60*60*24*15, '', '', $secure_cookie);
|
setcookie("oc_token", $token, $expires, '', '', $secure_cookie);
|
||||||
|
setcookie("oc_remember_login", true, $expires, '', '', $secure_cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue