]> source.dussan.org Git - nextcloud-server.git/commitdiff
Log if cookie login failed with token mismatch or session unavailability 33772/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 31 Aug 2022 08:37:48 +0000 (10:37 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 31 Aug 2022 12:55:51 +0000 (14:55 +0200)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
lib/private/User/Session.php

index 626ddca2dadd84c6da723ed073721abe0dee2eb5..65a213d4bf8087a93bde742d2071581f0167c1d9 100644 (file)
@@ -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']);