mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 19:59:18 -08:00
Updated throttling override for 5.3
This commit is contained in:
parent
69031d4215
commit
68ac4abe2c
|
@ -285,17 +285,34 @@ class LoginController extends Controller
|
|||
*/
|
||||
protected function sendLockoutResponse(Request $request)
|
||||
{
|
||||
$seconds = $this->limiter()->availableIn(
|
||||
$this->throttleKey($request)
|
||||
);
|
||||
$seconds = $this->limiter()->availableIn(
|
||||
$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);
|
||||
|
||||
return redirect()->back()
|
||||
->withInput($request->only($this->username(), 'remember'))
|
||||
->withErrors([$this->username() => $message]);
|
||||
$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
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.',
|
||||
|
|
Loading…
Reference in a new issue