From: Christoph Wurst Date: Wed, 31 Aug 2022 08:37:48 +0000 (+0200) Subject: Log if cookie login failed with token mismatch or session unavailability X-Git-Tag: v24.0.6rc1~9^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c39135a294cd41e5cb3750e012815492abc91cf1;p=nextcloud-server.git Log if cookie login failed with token mismatch or session unavailability Signed-off-by: Christoph Wurst --- diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 365a01c4595..a0e0e5c1dc8 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -865,6 +865,10 @@ class Session implements IUserSession, Emitter { $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', [ + 'app' => 'core', + 'uid' => $uid, + ]); return false; } // replace successfully used token with a new one @@ -876,6 +880,10 @@ class Session implements IUserSession, Emitter { $sessionId = $this->session->getId(); $token = $this->tokenProvider->renewSessionToken($oldSessionId, $sessionId); } catch (SessionNotAvailableException $ex) { + $this->logger->warning('Could not renew session token for {uid} because the session is unavailable', [ + 'app' => 'core', + 'uid' => $uid, + ]); return false; } catch (InvalidTokenException $ex) { $this->logger->warning('Renewing session token failed', ['app' => 'core']);