Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,15 @@ public function loginWithCookie($uid, $currentToken, $oldSessionId) {
$tokens = $this->config->getUserKeys($uid, 'login_token');
// test cookies token against stored tokens
if (!in_array($currentToken, $tokens, true)) {
$this->logger->error('Tried to log in {uid} but could not verify token', [
'uid' => $uid,
]);
// The user is possibly logged in, but the token can't be verified. As
// a safety measure we end the session and log the user out
// TODO: what if two requests go through this method concurrently, wouldn't
// one of them win and make the other one appear invalid do to the
// same token that no longer exists in the database?
$this->logout();
return false;
}
// replace successfully used token with a new one
Expand Down