尝试使用错误的凭据后,我可以锁定用户。通过在AuthController.php中覆盖此方法
public function maxLoginAttempts()
{
return 4;
}
public function lockoutTime()
{
return 5;
}
但是我想锁定用户两次。首先,我想在尝试5次10分钟后锁定,然后在尝试10次30分钟后锁定。这是我在AuthController中的登录功能
public function login(Request $request)
{
$this->validateLogin($request);
$throttles = $this->isUsingThrottlesLoginsTrait();
if ($throttles && $lockedOut = $this->hasTooManyLoginAttempts($request))
{
$this->fireLockoutEvent($request);
return $this->sendLockoutResponse($request);
}
$credentials = $this->getCredentials($request);
if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
if ($throttles && ! $lockedOut) {
$this->incrementLoginAttempts($request);
}
return $this->sendFailedLoginResponse($request);
}