Skip to content

Commit ff211b6

Browse files
committed
fix: Add backtrace when login fails
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 5a2eafc commit ff211b6

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lib/private/User/Session.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public function logClientIn($user,
455455
}
456456

457457
private function handleLoginFailed(IThrottler $throttler, int $currentDelay, string $remoteAddress, string $user, ?string $password) {
458-
$this->logger->warning("Login failed: '" . $user . "' (Remote IP: '" . $remoteAddress . "')", ['app' => 'core']);
458+
$this->logger->warning("Login failed: '" . $user . "' (Remote IP: '" . $remoteAddress . "')", ['app' => 'core', 'exception' => new \Exception()]);
459459

460460
$throttler->registerAttempt('login', $remoteAddress, ['user' => $user]);
461461
$this->dispatcher->dispatchTyped(new OC\Authentication\Events\LoginFailed($user, $password));
@@ -767,11 +767,9 @@ private function checkTokenCredentials(IToken $dbToken, $token, array &$reason)
767767
*
768768
* Invalidates the token if checks fail
769769
*
770-
* @param string $token
771-
* @param string $user login name
772-
* @return boolean
770+
* @param ?string $user The login name
773771
*/
774-
private function validateToken($token, $user = null) {
772+
private function validateToken(string $token, ?string $user = null): bool {
775773
try {
776774
$dbToken = $this->tokenProvider->getToken($token);
777775
} catch (InvalidTokenException $ex) {

0 commit comments

Comments
 (0)