Customizing Laravel 8 Fortify Login Rate Limiter Hello,
In the app\Providers\FortifyServiceProvider.php boot function there is a rate limiter for login and two-factor:
RateLimiter::for('login', function (Request $request) {
return Limit::perMinute(5)->by($request->email.$request->ip());
});
How i can do something like sending an email when the limiter was reached?
In the documentation https://laravel.com/api/8.x/Illuminate/Cache/RateLimiter.html i see a tooManyAttempts function, but how i can use it in this case?
I have found the answer in here :
https://laravel.com/api/8.x/Illuminate/Cache/RateLimiting/Limit.html
And the result is something like :
RateLimiter::for('login', function (Request $request) {
return Limit::perMinute(5)->by($request->email.$request->ip())->response(function(){
Log::channel('api')->info('locked!!');
// more logic here
abort(429);
});
});
Please sign in or create an account to participate in this conversation.