]> source.dussan.org Git - nextcloud-server.git/commitdiff
Log if cookie login failed with token mismatch or session unavailability 33786/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 31 Aug 2022 08:37:48 +0000 (10:37 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 1 Sep 2022 07:34:30 +0000 (07:34 +0000)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
lib/private/User/Session.php

index 7aea219b6089e42bb350f8bc5e9d687d929e228b..4ef9e6fdbcbfacd4ee3c2afd60d8634f6ff9bfc3 100644 (file)
@@ -877,6 +877,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
@@ -888,6 +892,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) {
                        \OC::$server->getLogger()->warning('Renewing session token failed', ['app' => 'core']);