Skip to content

Commit

Permalink
fix authenticateUsing getting called twice
Browse files Browse the repository at this point in the history
  • Loading branch information
webdevnerdstuff committed Apr 23, 2024
1 parent 0c1721f commit 5fae9fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Actions/AttemptToAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function handle($request, $next)
*/
protected function handleUsingCustomCallback($request, $next)
{
$user = call_user_func(Fortify::$authenticateUsingCallback, $request);
$user = $request['authUser'] ?? call_user_func(Fortify::$authenticateUsingCallback, $request);

if (! $user) {
$this->fireFailedEvent($request);
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/RedirectIfTwoFactorAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(StatefulGuard $guard, LoginRateLimiter $limiter)
*/
public function handle($request, $next)
{
$user = $this->validateCredentials($request);
$user = $request['authUser'] ?? $this->validateCredentials($request);

if (Fortify::confirmsTwoFactorAuthentication()) {
if (optional($user)->two_factor_secret &&
Expand Down
2 changes: 2 additions & 0 deletions src/Http/Controllers/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ protected function loginPipeline(LoginRequest $request)
));
}

$request['authUser'] = call_user_func(Fortify::$authenticateUsingCallback, $request);

return (new Pipeline(app()))->send($request)->through(array_filter([
config('fortify.limiters.login') ? null : EnsureLoginIsNotThrottled::class,
config('fortify.lowercase_usernames') ? CanonicalizeUsername::class : null,
Expand Down

0 comments on commit 5fae9fc

Please sign in to comment.