账号锁定后,5分钟后自动解锁
parent
31e20d139c
commit
470c9c25c9
|
|
@ -33,11 +33,15 @@ class AuthController extends Controller
|
||||||
|
|
||||||
$user = AdminUser::where(['username' => $username])->first();
|
$user = AdminUser::where(['username' => $username])->first();
|
||||||
|
|
||||||
|
$cacheKey = "admin_user_ban:{$username}";
|
||||||
|
|
||||||
if ($user?->banned_at) {
|
if ($user?->banned_at) {
|
||||||
|
if ($user->banned_at->addMinutes(5)->gte(now())) {
|
||||||
return $this->error('账号已封禁,请联系管理员');
|
return $this->error('账号已封禁,请联系管理员');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cacheKey = "admin_user_ban:{$username}";
|
$this->cache->forget($cacheKey);
|
||||||
|
}
|
||||||
|
|
||||||
if (! Hash::check($request->input('password'), (string) $user?->password)) {
|
if (! Hash::check($request->input('password'), (string) $user?->password)) {
|
||||||
$this->cache->add($cacheKey, 0, 86400);
|
$this->cache->add($cacheKey, 0, 86400);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue