Maybe check out the Laravel Throttle package.
How to add a condition for logging in (while still using Laravel's built-in authentication)
Hi, I am trying to add a custom condition for logging in a user, so that I can prevent a brute force attack. So for example, only letting the user log in if they have less than 3 failed log-in attempts in the last 10 minutes.
I tried adding the following code to AuthController.php (it is a simplified version of the code provided in the docs) to test if it controls who can log in, but it did not work. I'm not sure where I would need to call the function:
public function authenticate()
{
if (Auth::attempt(['email' => 'someone@example.com']))
{
return redirect()->intended('dashboard');
}
}
I would rather not have to write out every part of the authentication myself. Is there a way of using the provided authentication but just adding an extra condition myself, please?
Please or to participate in this conversation.