Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attempts method to rate limiter #85

Merged
merged 2 commits into from
Sep 23, 2020
Merged

Add attempts method to rate limiter #85

merged 2 commits into from
Sep 23, 2020

Conversation

nicolaferrara82
Copy link
Contributor

At the moment it was missing attempts() method for the $limiter and I am unable to track it in my custom login procedure:

Fortify::authenticateUsing(function (Request $request) {
            $user = User::where(config('fortify.username'), $request->{config('fortify.username')})->first();

            if($user){
                if(!$user->active){ 
                    $limiter = resolve(LoginRateLimiter::class);
                    $limiter->increment($request);

                    throw ValidationException::withMessages([
                        'inactive' => [trans('auth.inactive',['attempts' => $limiter->attempts($request)])],
                    ]);
                }

                if (Hash::check($request->password, $user->password)) {
                    return $user;
                }
            }
});

@taylorotwell taylorotwell merged commit 9661c0c into laravel:1.x Sep 23, 2020
@driesvints driesvints changed the title Update LoginRateLimiter.php Add attempts method to rate limiter Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants