Explorar o código

Merge branch 'feature/ip_check_new_limit' into feature/NC-45

jerry hai 1 ano
pai
achega
00f7214ddd
Modificáronse 1 ficheiros con 3 adicións e 8 borrados
  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;
     }
     }