Merge pull request #45026 from nextcloud/fix/token-update

Avoid updating the same oc_authtoken row twice
pull/45355/head
Christoph Wurst 2024-05-16 12:00:32 +07:00 committed by GitHub
commit fe7217d2d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

@ -376,7 +376,7 @@ $CONFIG = [
* Tokens are still checked every 5 minutes for validity * Tokens are still checked every 5 minutes for validity
* max value: 300 * max value: 300
* *
* Defaults to ``300`` * Defaults to ``60``
*/ */
'token_auth_activity_update' => 60, 'token_auth_activity_update' => 60,

@ -308,6 +308,8 @@ class PublicKeyTokenProvider implements IProvider {
if (!($token instanceof PublicKeyToken)) { if (!($token instanceof PublicKeyToken)) {
throw new InvalidTokenException("Invalid token type"); throw new InvalidTokenException("Invalid token type");
} }
$now = $this->time->getTime();
$token->setLastActivity($now);
$this->mapper->update($token); $this->mapper->update($token);
$this->cacheToken($token); $this->cacheToken($token);
} }