Skip to content

Commit 0cc6928

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

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
@@ -300,8 +300,6 @@ public function updateToken(IToken $token) {
300300
if (!($token instanceof PublicKeyToken)) {
301301
throw new InvalidTokenException("Invalid token type");
302302
}
303-
$now = $this->time->getTime();
304-
$token->setLastActivity($now);
305303
$this->mapper->update($token);
306304
$this->cacheToken($token);
307305
}

lib/private/User/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
4646
use OC\Authentication\Token\IProvider;
4747
use OC\Authentication\Token\IToken;
48+
use OC\Authentication\Token\PublicKeyToken;
4849
use OC\Hooks\Emitter;
4950
use OC\Hooks\PublicEmitter;
5051
use OC_User;
@@ -772,6 +773,9 @@ private function checkTokenCredentials(IToken $dbToken, $token) {
772773
}
773774

774775
$dbToken->setLastCheck($now);
776+
if ($dbToken instanceof PublicKeyToken) {
777+
$dbToken->setLastActivity($now);
778+
}
775779
$this->tokenProvider->updateToken($dbToken);
776780
return true;
777781
}

0 commit comments

Comments
 (0)