Updated throttling override for 5.3

This commit is contained in:
snipe 2016-12-14 06:30:51 -08:00
parent 69031d4215
commit 68ac4abe2c
2 changed files with 27 additions and 10 deletions

View file

@ -289,13 +289,30 @@ class LoginController extends Controller
$this->throttleKey($request)
);
$message = \Lang::has('auth/message.throttle')
? \Lang::get('auth/message.throttle', ['seconds' => $seconds])
: 'Too many login attempts. Please try again in '.$seconds.' seconds.';
$minutes = round($seconds / 60);
$message = \Lang::get('auth/message.throttle',['minutes' => $minutes]);
return redirect()->back()
->withInput($request->only($this->username(), 'remember'))
->withErrors([$this->username() => $message]);
}
/**
* Override the lockout time and duration
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
protected function hasTooManyLoginAttempts(Request $request)
{
$lockoutTime = config('auth.throttle.lockout_duration');
$maxLoginAttempts = config('auth.throttle.max_attempts');
return $this->limiter()->tooManyAttempts(
$this->throttleKey($request), $maxLoginAttempts, $lockoutTime
);
}
}

View file

@ -7,7 +7,7 @@ return array(
'account_not_activated' => 'This user account is not activated.',
'account_suspended' => 'This user account is suspended.',
'account_banned' => 'This user account is banned.',
'throttle' => 'Too many failed login attempts. Please try again in :seconds seconds.',
'throttle' => 'Too many failed login attempts. Please try again in around :minutes minute(s).',
'signin' => array(
'error' => 'There was a problem while trying to log you in, please try again.',