예제 #1
0
 /**
  * Validates form and logs the user in.
  * @return boolean whether the user is logged in successfully
  */
 public function login()
 {
     if ($this->validate()) {
         $success = \Yii::$app->getUser()->login($this->user, $this->rememberMe ? $this->module->rememberFor : 0);
         $this->createHistoryEntry($success);
         $this->user->updateAttributes(['login_count' => $this->user->login_count + 1]);
         return $success;
     } else {
         return false;
     }
 }