From ef94d4535c724869c6ea9b85939e9287ee42f14b Mon Sep 17 00:00:00 2001 From: EMMAN Date: Tue, 2 Jan 2024 04:49:44 +0800 Subject: [PATCH 1/3] auth.throttle time countdown added --- src/Middleware/Throttle.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Middleware/Throttle.php b/src/Middleware/Throttle.php index cf26e56f..9a99af6c 100644 --- a/src/Middleware/Throttle.php +++ b/src/Middleware/Throttle.php @@ -37,8 +37,12 @@ public function handle($request, Closure $next) protected function getToManyAttemptsMessage() { - return Lang::has('auth.to_many_attempts') - ? trans('auth.to_many_attempts') - : 'To many attempts!'; + $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; } } From b941769c512d25d4fe7803f5e71e7613609ab14f Mon Sep 17 00:00:00 2001 From: EMMAN Date: Tue, 2 Jan 2024 23:56:24 +0800 Subject: [PATCH 2/3] Throttle.php fixed --- src/Middleware/Throttle.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Middleware/Throttle.php b/src/Middleware/Throttle.php index 9a99af6c..c4282aa0 100644 --- a/src/Middleware/Throttle.php +++ b/src/Middleware/Throttle.php @@ -35,8 +35,7 @@ public function handle($request, Closure $next) return $next($request); } - protected function getToManyAttemptsMessage() - { + protected function getToManyAttemptsMessage() { $seconds = RateLimiter::availableIn('login-tries-' . Admin::guardName()); $message = Lang::has('auth.throttle') From 54496d9001c4528480b20d149e27c9d7515684c7 Mon Sep 17 00:00:00 2001 From: EMMAN Date: Wed, 3 Jan 2024 00:04:42 +0800 Subject: [PATCH 3/3] auth.throttle: countdown added --- src/Middleware/Throttle.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Middleware/Throttle.php b/src/Middleware/Throttle.php index c4282aa0..4cc2783c 100644 --- a/src/Middleware/Throttle.php +++ b/src/Middleware/Throttle.php @@ -35,6 +35,7 @@ public function handle($request, Closure $next) return $next($request); } + //auth.throttle: countdown added protected function getToManyAttemptsMessage() { $seconds = RateLimiter::availableIn('login-tries-' . Admin::guardName());