From 470c9c25c9417d8d3a160e7e5b2dde1edea1c13e Mon Sep 17 00:00:00 2001 From: Jing Li Date: Sun, 2 Jun 2024 20:40:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E9=94=81=E5=AE=9A=E5=90=8E,5?= =?UTF-8?q?=E5=88=86=E9=92=9F=E5=90=8E=E8=87=AA=E5=8A=A8=E8=A7=A3=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AuthController.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 3709f22..f300b23 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -33,12 +33,16 @@ class AuthController extends Controller $user = AdminUser::where(['username' => $username])->first(); - if ($user?->banned_at) { - return $this->error('账号已封禁,请联系管理员'); - } - $cacheKey = "admin_user_ban:{$username}"; + if ($user?->banned_at) { + if ($user->banned_at->addMinutes(5)->gte(now())) { + return $this->error('账号已封禁,请联系管理员'); + } + + $this->cache->forget($cacheKey); + } + if (! Hash::check($request->input('password'), (string) $user?->password)) { $this->cache->add($cacheKey, 0, 86400);