فهرست منبع

优化前台会员登录

Karson 7 ماه پیش
والد
کامیت
e7c1922cf3
1فایلهای تغییر یافته به همراه6 افزوده شده و 0 حذف شده
  1. 6 0
      application/common/library/Auth.php

+ 6 - 0
application/common/library/Auth.php

@@ -221,7 +221,13 @@ class Auth
             $this->setError('Account is locked');
             $this->setError('Account is locked');
             return false;
             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)) {
         if ($user->password != $this->getEncryptPassword($password, $user->salt)) {
+            $user->save(['loginfailure' => $user->loginfailure + 1, 'loginfailuretime' => time()]);
             $this->setError('Password is incorrect');
             $this->setError('Password is incorrect');
             return false;
             return false;
         }
         }