mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -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)
|
protected function sendLockoutResponse(Request $request)
|
||||||
{
|
{
|
||||||
$seconds = $this->limiter()->availableIn(
|
$seconds = $this->limiter()->availableIn(
|
||||||
$this->throttleKey($request)
|
$this->throttleKey($request)
|
||||||
);
|
);
|
||||||
|
|
||||||
$message = \Lang::has('auth/message.throttle')
|
$minutes = round($seconds / 60);
|
||||||
? \Lang::get('auth/message.throttle', ['seconds' => $seconds])
|
|
||||||
: 'Too many login attempts. Please try again in '.$seconds.' seconds.';
|
|
||||||
|
|
||||||
return redirect()->back()
|
$message = \Lang::get('auth/message.throttle',['minutes' => $minutes]);
|
||||||
->withInput($request->only($this->username(), 'remember'))
|
|
||||||
->withErrors([$this->username() => $message]);
|
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_not_activated' => 'This user account is not activated.',
|
||||||
'account_suspended' => 'This user account is suspended.',
|
'account_suspended' => 'This user account is suspended.',
|
||||||
'account_banned' => 'This user account is banned.',
|
'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(
|
'signin' => array(
|
||||||
'error' => 'There was a problem while trying to log you in, please try again.',
|
'error' => 'There was a problem while trying to log you in, please try again.',
|
||||||
|
|
Loading…
Reference in a new issue