Merge pull request #45349 from nextcloud/backport/45026/stable28

[stable28] Avoid updating the same oc_authtoken row twice
This commit is contained in:
Daniel 2024-06-02 22:06:38 +02:00 committed by GitHub
commit aac7365d7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

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

View file

@ -43,6 +43,7 @@ use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OC\Authentication\Token\PublicKeyToken;
use OC\Hooks\Emitter;
use OC\Hooks\PublicEmitter;
use OC_User;
@ -774,6 +775,9 @@ class Session implements IUserSession, Emitter {
}
$dbToken->setLastCheck($now);
if ($dbToken instanceof PublicKeyToken) {
$dbToken->setLastActivity($now);
}
$this->tokenProvider->updateToken($dbToken);
return true;
}