From: Sandro Santilli Date: Fri, 21 Apr 2017 14:15:39 +0000 (+0200) Subject: Allow specifying cookie lifetime via config variable X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=05b6891e89c52f325aaa910f853938b39bf8129e;p=friendica.git Allow specifying cookie lifetime via config variable Tweak $a->config['system']['auth_cookie_lifetime'] --- diff --git a/htconfig.php b/htconfig.php index 4ea97e9aeb..08beb0b50e 100644 --- a/htconfig.php +++ b/htconfig.php @@ -91,3 +91,6 @@ $a->config['system']['directory'] = 'https://dir.friendica.social'; // Allowed protocols in link URLs; HTTP protocols always are accepted $a->config['system']['allowed_link_protocols'] = array('ftp', 'ftps', 'mailto', 'cid', 'gopher'); + +// Authentication cookie lifetime, in days +$a->config['system']['auth_cookie_lifetime'] = 7 diff --git a/include/auth.php b/include/auth.php index 636b5b153a..2258128c5d 100644 --- a/include/auth.php +++ b/include/auth.php @@ -19,8 +19,10 @@ if (isset($_COOKIE["Friendica"])) { } // Renew the cookie - // Expires after 90 days - TODO: use a configuration variable - new_cookie(90*24*60*60, $r[0]); + // Expires after 7 days by default, + // can be set via system.auth_cookie_lifetime + $authcookiedays = get_config('system','auth_cookie_lifetime') || 7; + new_cookie($authcookiedays*24*60*60, $r[0]); // Do the authentification if not done by now if (!isset($_SESSION) OR !isset($_SESSION['authenticated'])) {