Skip to content

Commit 6293c5a

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
fix: Handle 2fa enforcement earlier
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 8a0eaca commit 6293c5a

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
@@ -412,10 +412,8 @@ public function logClientIn($user,
412412
return false;
413413
}
414414

415-
if (!$isTokenPassword && $this->isTokenAuthEnforced()) {
416-
throw new PasswordLoginForbiddenException();
417-
}
418-
if (!$isTokenPassword && $this->isTwoFactorEnforced($user)) {
415+
if (!$isTokenPassword && ($this->isTokenAuthEnforced() || $this->isTwoFactorEnforced($user))) {
416+
$this->handleLoginFailed($throttler, $currentDelay, $remoteAddress, $user, $password);
419417
throw new PasswordLoginForbiddenException();
420418
}
421419

@@ -570,7 +568,8 @@ public function tryBasicAuthLogin(IRequest $request,
570568
// If credentials were provided, they need to be valid, otherwise we do boom
571569
throw new LoginException();
572570
} catch (PasswordLoginForbiddenException $ex) {
573-
// Nothing to do
571+
// If credentials were provided, they need to be valid, otherwise we do boom
572+
throw new LoginException(previous: $ex);
574573
}
575574
}
576575
return false;

0 commit comments

Comments
 (0)