Skip to content

Commit

Permalink
Merge pull request #45351 from nextcloud/backport/45026/stable27
Browse files Browse the repository at this point in the history
[stable27] Avoid updating the same oc_authtoken row twice
  • Loading branch information
AndyScherzinger authored Jun 4, 2024
2 parents 00130d7 + 0cc6928 commit 3c0479d
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 @@ -339,7 +339,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 @@ -45,6 +45,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 @@ -772,6 +773,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 3c0479d

Please sign in to comment.