Skip to content

Commit b08d22d

Browse files
committed
fix: Handle 2fa enforcement earlier
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 7a91d77 commit b08d22d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

lib/private/User/Session.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,8 @@ public function logClientIn($user,
418418
return false;
419419
}
420420

421-
if (!$isTokenPassword && $this->isTokenAuthEnforced()) {
422-
throw new PasswordLoginForbiddenException();
423-
}
424-
if (!$isTokenPassword && $this->isTwoFactorEnforced($user)) {
421+
if (!$isTokenPassword && ($this->isTokenAuthEnforced() || $this->isTwoFactorEnforced($user))) {
422+
$this->handleLoginFailed($throttler, $currentDelay, $remoteAddress, $user, $password);
425423
throw new PasswordLoginForbiddenException();
426424
}
427425

@@ -576,7 +574,8 @@ public function tryBasicAuthLogin(IRequest $request,
576574
// If credentials were provided, they need to be valid, otherwise we do boom
577575
throw new LoginException();
578576
} catch (PasswordLoginForbiddenException $ex) {
579-
// Nothing to do
577+
// If credentials were provided, they need to be valid, otherwise we do boom
578+
throw new LoginException(previous: $ex);
580579
}
581580
}
582581
return false;

0 commit comments

Comments
 (0)