mirror of
https://github.com/friendica/friendica
synced 2024-12-23 03:20:15 +00:00
Add API login capture 12h cooldown to spare database writes
This commit is contained in:
parent
43e6cec200
commit
677eaf78ed
1 changed files with 4 additions and 1 deletions
|
@ -264,7 +264,10 @@ function api_login(App $a)
|
|||
throw new UnauthorizedException("This API requires login");
|
||||
}
|
||||
|
||||
DI::auth()->setForUser($a, $record, false, false, true);
|
||||
// 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue