Skip to content

Commit 0002db5

Browse files
ChristophWurstkesselb
authored andcommitted
fix(auth): Update authtoken activity selectively
Signed-off-by: Christoph Wurst <[email protected]>
1 parent f2c2149 commit 0002db5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/private/Authentication/Token/PublicKeyTokenProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ public function updateToken(OCPIToken $token) {
308308
if (!($token instanceof PublicKeyToken)) {
309309
throw new InvalidTokenException("Invalid token type");
310310
}
311-
$now = $this->time->getTime();
312-
$token->setLastActivity($now);
313311
$this->mapper->update($token);
314312
$this->cacheToken($token);
315313
}

lib/private/User/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
4444
use OC\Authentication\Token\IProvider;
4545
use OC\Authentication\Token\IToken;
46+
use OC\Authentication\Token\PublicKeyToken;
4647
use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
4748
use OC\Hooks\Emitter;
4849
use OC\Hooks\PublicEmitter;
@@ -786,6 +787,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
786787
}
787788

788789
$dbToken->setLastCheck($now);
790+
if ($dbToken instanceof PublicKeyToken) {
791+
$dbToken->setLastActivity($now);
792+
}
789793
$this->tokenProvider->updateToken($dbToken);
790794
return true;
791795
}

0 commit comments

Comments
 (0)