|
|
@@ -120,10 +120,9 @@ class LoginForm extends Model
|
|
|
throw new Exception($siteCloseInfo);
|
|
|
}
|
|
|
$transaction = \Yii::$app->db->beginTransaction();
|
|
|
+
|
|
|
+ $result = false;
|
|
|
try{
|
|
|
- // 验证IP
|
|
|
- (new IpFilter())->frontApiCheck();
|
|
|
-
|
|
|
$this->getUser();
|
|
|
if(!$this->_user){
|
|
|
throw new Exception('账号不存在');
|
|
|
@@ -183,15 +182,22 @@ class LoginForm extends Model
|
|
|
|
|
|
// 把用户的登录时间存在操作时间里
|
|
|
Yii::$app->tokenRedis->hset('user:timeOut', $this->_userInfo['USER_ID'], time());
|
|
|
+ $result = Yii::$app->user->loginWithUAndP($this->_user);
|
|
|
|
|
|
- return Yii::$app->user->loginWithUAndP($this->_user);
|
|
|
}catch(\Exception $e){
|
|
|
|
|
|
$transaction->rollBack();
|
|
|
$this->setError($e->getMessage());
|
|
|
//AdminLoginLogger::fail($this->_user, $e->getMessage());
|
|
|
- return false;
|
|
|
}
|
|
|
+
|
|
|
+ try{
|
|
|
+ (new IpFilter())->frontApiCheck();
|
|
|
+ } catch(\Exception $e){
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
}
|
|
|
|
|
|
/**
|