jerry 1 年之前
父节点
当前提交
dc8a9623f9
共有 1 个文件被更改,包括 3 次插入8 次删除
  1. 3 8
      frontendApi/modules/v1/models/LoginForm.php

+ 3 - 8
frontendApi/modules/v1/models/LoginForm.php

@@ -123,7 +123,10 @@ class LoginForm extends Model
 
 
         $result = false;
         $result = false;
         try{
         try{
+            // 验证IP
+            (new IpFilter())->frontApiCheck(true);
             $this->getUser();
             $this->getUser();
+
             if(!$this->_user){
             if(!$this->_user){
                 throw new Exception('账号不存在');
                 throw new Exception('账号不存在');
             }
             }
@@ -185,19 +188,11 @@ class LoginForm extends Model
             $result = Yii::$app->user->loginWithUAndP($this->_user);
             $result = Yii::$app->user->loginWithUAndP($this->_user);
 
 
         }catch(\Exception $e){
         }catch(\Exception $e){
-
             $transaction->rollBack();
             $transaction->rollBack();
             $this->setError($e->getMessage());
             $this->setError($e->getMessage());
             //AdminLoginLogger::fail($this->_user, $e->getMessage());
             //AdminLoginLogger::fail($this->_user, $e->getMessage());
         }
         }
 
 
-        try{
-            (new IpFilter())->frontApiCheck(true);
-        } catch(\Exception $exception){
-            $this->clearErrors();
-            $this->setError($exception->getMessage());
-        }
-
         return $result;
         return $result;
     }
     }