Wanted to Lock Particular User if he Trying for multiple Login Attempts. How to lock User Id , IP address for any Specific Controller?
Laravel Passport Token for Generation
if ($this->hasTooManyLoginAttempts($request)) {
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
if ($this->attemptLogin($request)) {
return $this->sendLoginResponse($request);
}
$this->incrementLoginAttempts($request);
return $this->sendFailedLoginResponse($request);
Wanted use above code for Locking User
To customize the number of attempts and cooldown period you have to edit the middleware assigned to the
apigroup.To do so open up
app/Http/Kernel.phpand edit thethrottle:60,1line. Keep in mind that60,1means that the lockout will be fired after 60 failed attempts in one minute.The last thing you have to be sure is to wrap your login route in the api middleware to apply the throttle one to your route.