Skip to content

Commit 9880800

Browse files
ChristophWurstkesselb
authored andcommitted
fix(auth): Update authtoken activity selectively
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent 41528b1 commit 9880800

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/private/Authentication/Token/PublicKeyTokenProvider.php

-2
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

+4
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\Hooks\Emitter;
4748
use OC\Hooks\PublicEmitter;
4849
use OC_User;
@@ -774,6 +775,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
774775
}
775776

776777
$dbToken->setLastCheck($now);
778+
if ($dbToken instanceof PublicKeyToken) {
779+
$dbToken->setLastActivity($now);
780+
}
777781
$this->tokenProvider->updateToken($dbToken);
778782
return true;
779783
}

0 commit comments

Comments
 (0)