From 7ac7747bfb58f1f81e991533924da020e8dddd8f Mon Sep 17 00:00:00 2001 From: EMMAN Date: Wed, 3 Jan 2024 00:00:08 +0800 Subject: [PATCH] Throttle.php added the countdown timer on getToManyAttemptsMessage() function Throttle.php added the countdown timer on getToManyAttemptsMessage() function --- src/Middleware/Throttle.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Middleware/Throttle.php b/src/Middleware/Throttle.php index cf26e56..c4282aa 100644 --- a/src/Middleware/Throttle.php +++ b/src/Middleware/Throttle.php @@ -35,10 +35,13 @@ 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!'; + 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; } }