diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index ea1e5484dda7b..3a15ba006d461 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -308,8 +308,6 @@ public function updateToken(OCPIToken $token) { if (!($token instanceof PublicKeyToken)) { throw new InvalidTokenException("Invalid token type"); } - $now = $this->time->getTime(); - $token->setLastActivity($now); $this->mapper->update($token); $this->cacheToken($token); } diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index d718763994934..0360d57c0eba6 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -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\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager; use OC\Hooks\Emitter; use OC\Hooks\PublicEmitter; @@ -784,6 +785,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) { } $dbToken->setLastCheck($now); + if ($dbToken instanceof PublicKeyToken) { + $dbToken->setLastActivity($now); + } $this->tokenProvider->updateToken($dbToken); return true; }