From e7c1922cf3e5d555eee33ff65b501c91ee31e9c6 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 3 Sep 2024 10:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=89=8D=E5=8F=B0=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Auth.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index f8a92a1c..f3ed90f6 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -221,7 +221,13 @@ class Auth $this->setError('Account is locked'); return false; } + + if ($user->loginfailure >= 10 && time() - $user->loginfailuretime < 86400) { + $this->setError('Please try again after 1 day'); + } + if ($user->password != $this->getEncryptPassword($password, $user->salt)) { + $user->save(['loginfailure' => $user->loginfailure + 1, 'loginfailuretime' => time()]); $this->setError('Password is incorrect'); return false; }