From ccd56e994a8a7b4a3fa8613b043e5e710b1a7e4c Mon Sep 17 00:00:00 2001 From: EMMAN Date: Wed, 3 Jan 2024 00:08:12 +0800 Subject: [PATCH] auth.throttle: countdown added auth.throttle: countdown added --- src/Middleware/Throttle.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Middleware/Throttle.php b/src/Middleware/Throttle.php index cf26e56f..4cc2783c 100644 --- a/src/Middleware/Throttle.php +++ b/src/Middleware/Throttle.php @@ -35,10 +35,14 @@ public function handle($request, Closure $next) return $next($request); } - protected function getToManyAttemptsMessage() - { - return Lang::has('auth.to_many_attempts') - ? trans('auth.to_many_attempts') - : 'To many attempts!'; + //auth.throttle: countdown added + protected function getToManyAttemptsMessage() { + $seconds = RateLimiter::availableIn('login-tries-' . Admin::guardName()); + + $message = Lang::has('auth.throttle') + ? trans('auth.throttle', ['seconds' => $seconds]) + : "Too many login attempts. Please try again in " . $seconds . " seconds."; + + return $message; } }