Esempio n. 1
0
 public function actionLogin()
 {
     $model = \Yii::createObject(LoginForm::className());
     $this->performAjaxValidation($model);
     //        $user_remote= new UserRemote();
     //        $params=\Yii::$app->getRequest()->post();
     //        var_dump($params);die;
     //        if (isset($params['login-form'])){
     //            var_dump($params['login-form']['login'],$params['login-form']['password']);die;
     //        $ruser=$user_remote->getRemoteUser($params['login-form']['login'],$params['login-form']['password']);
     //        }
     if ($model->load(\Yii::$app->getRequest()->post()) && $model->login()) {
         return $this->goBack();
     }
     return $this->render('login', ['model' => $model, 'module' => $this->module]);
 }
 /**
  * Displays the login page.
  *
  * @return string|Response
  */
 public function actionLogin()
 {
     if (!Yii::$app->user->isGuest) {
         $this->goHome();
     }
     /** @var LoginForm $model */
     $model = Yii::createObject(LoginForm::className());
     $this->performAjaxValidation($model);
     if ($model->load(Yii::$app->getRequest()->post()) && $model->login()) {
         $profile = Profile::findOne(Yii::$app->user->id);
         if (empty($profile->name) || empty($profile->location)) {
             return $this->redirect(['settings/profile?complete=1']);
         } else {
             return $this->goBack();
         }
     }
     return $this->render('login', ['model' => $model, 'module' => $this->module]);
 }