Skip to content

Commit

Permalink
Merge pull request #45349 from nextcloud/backport/45026/stable28
Browse files Browse the repository at this point in the history
[stable28] Avoid updating the same oc_authtoken row twice
  • Loading branch information
kesselb authored Jun 2, 2024
2 parents 7b087ee + 9880800 commit aac7365
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@
* Tokens are still checked every 5 minutes for validity
* max value: 300
*
* Defaults to ``300``
* Defaults to ``60``
*/
'token_auth_activity_update' => 60,

Expand Down
4 changes: 4 additions & 0 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
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;
Expand Down Expand Up @@ -774,6 +775,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
}

$dbToken->setLastCheck($now);
if ($dbToken instanceof PublicKeyToken) {
$dbToken->setLastActivity($now);
}
$this->tokenProvider->updateToken($dbToken);
return true;
}
Expand Down

0 comments on commit aac7365

Please sign in to comment.