I just installed Laravel 9 and Laravel Fortify. However, the rate limit for the login function is incorrect.
FortifyServiceProvider.php
public function boot()
{
Fortify::createUsersUsing(CreateNewUser::class);
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
RateLimiter::for('login', function (Request $request) {
$email = (string) $request->email;
return Limit::perMinute(5)->by($email.$request->ip());
});
RateLimiter::for('two-factor', function (Request $request) {
return Limit::perMinute(5)->by($request->session()->get('login.id'));
});
}
As you can see, it shows five requests per minute. However, whenever I tried to log in incorrectly after the first request, it kept giving me an error 429: Too Many Requests
. This is because it only allows me to log in one time.
I tried on both PHP versions, 8.0 and 8.1.2.
Update:
I also tried Laravel v8.
Dev environment: Laragon also tried with Laradock (docker) but still the same issue.