X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fauth.php;h=b534d4a4d3a7f170a51a1b3735315c9345294d8d;hb=c22f65bafa08ea348d55fb1f3c05774b0f320c99;hp=1ddba7c880d46f72a64ebbe90d07237ecaabff70;hpb=e116712bf5d2e8e84971a456dc5043144ae48e75;p=friendica.git diff --git a/include/auth.php b/include/auth.php index 1ddba7c880..b534d4a4d3 100644 --- a/include/auth.php +++ b/include/auth.php @@ -2,6 +2,7 @@ require_once('include/security.php'); +require_once('include/datetime.php'); function nuke_session() { unset($_SESSION['authenticated']); @@ -68,7 +69,18 @@ if((isset($_SESSION)) && (x($_SESSION,'authenticated')) && ((! (x($_POST,'auth-p goaway(z_root()); } - authenticate_success($r[0]); + // Make sure to refresh the last login time for the user if the user + // stays logged in for a long time, e.g. with "Remember Me" + $login_refresh = false; + if(! x($_SESSION['last_login_date'])) { + $_SESSION['last_login_date'] = datetime_convert('UTC','UTC'); + } + if( strcmp(datetime_convert('UTC','UTC','now - 12 hours'), $_SESSION['last_login_date']) > 0 ) { + + $_SESSION['last_login_date'] = datetime_convert('UTC','UTC'); + $login_refresh = true; + } + authenticate_success($r[0], false, false, $login_refresh); } } else { @@ -191,6 +203,7 @@ else { // if we haven't failed up this point, log them in. + $_SESSION['last_login_date'] = datetime_convert('UTC','UTC'); authenticate_success($record, true, true); } }