frontend\models\LoginForm::login PHP Method

login() public method

Logs in a user using the provided mobile and password.
public login ( ) : boolean
return boolean whether the user is logged in successfully
    public function login()
    {
        if ($this->validate()) {
            return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
        } else {
            return false;
        }
    }

Usage Example

 public function testNotLoginInactiveUser()
 {
     $model = new LoginForm(['accountName' => 'erau-inactive', 'password' => 'password_0']);
     expect('model should not login user', $model->login())->false();
     expect('error message should be set', $model->errors)->hasKey('password');
     expect('user should not be logged in', Yii::$app->user->isGuest)->true();
 }
All Usage Examples Of frontend\models\LoginForm::login