Merge pull request #8802 from MrPetovan/task/8314-api-capture-login

Update user.login_date for authenticated API calls
This commit is contained in:
Michael Vogel 2020-06-23 21:23:08 +02:00 committed by GitHub
commit f5993463e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,10 @@ function api_login(App $a)
throw new UnauthorizedException("This API requires login");
}
DI::auth()->setForUser($a, $record);
// Don't refresh the login date more often than twice a day to spare database writes
$login_refresh = strcmp(DateTimeFormat::utc('now - 12 hours'), $record['login_date']) > 0;
DI::auth()->setForUser($a, $record, false, false, $login_refresh);
$_SESSION["allow_api"] = true;