/**
  * @param $_GET['redirect'] should be urlencoded
  * @param $_POST['LoginForm'] data to login
  */
 public function actionIndex($ref = null)
 {
     if (!empty($ref)) {
         Yii::$app->session->set('accountRef', $ref);
     }
     if (!$this->module->getUserIdentity()->isGuest) {
         if (Yii::$app->session->get('accountRef')) {
             $url = Yii::$app->session->get('accountRef');
             Yii::$app->session->remove('accountRef');
         } else {
             $url = Url::toManager('account/settings/index');
         }
         $this->redirect($url);
     }
     $model = new LoginForm();
     // see if values are sent via post
     if (Yii::$app->request->post('LoginForm')) {
         $model->attributes = Yii::$app->request->post('LoginForm');
         if (($userObject = $model->login()) !== false) {
             if ($this->module->getUserIdentity()->login($userObject)) {
                 $url = Yii::$app->session->get('accountRef');
                 if (!$url) {
                     $url = Url::toManager('account/settings/index');
                 } else {
                     Yii::$app->session->remove('accountRef');
                 }
                 $this->redirect($url);
             }
         }
     }
     return $this->renderLayout('index', ['model' => $model]);
 }
 /**
  * @param $_GET['redirect'] should be urlencoded
  * @param $_POST['LoginForm'] data to login
  */
 public function actionIndex()
 {
     if (!$this->module->getUserIdentity()->isGuest) {
         return $this->redirect(Url::toManager('account/settings/index'));
     }
     $model = new LoginForm();
     // see if values are sent via post
     if (Yii::$app->request->post('LoginForm')) {
         $model->attributes = Yii::$app->request->post('LoginForm');
         if (($userObject = $model->login()) !== false) {
             if ($this->module->getUserIdentity()->login($userObject)) {
                 $redirect = Yii::$app->request->get('redirect', false);
                 if (!$redirect) {
                     $redirect = Url::toManager('account/settings/index');
                 }
                 return $this->redirect($redirect);
             }
         }
     }
     return $this->render('index', ['model' => $model]);
 }