示例#1
0
 public function actionLogin()
 {
     /*echo Yii::$app->user->isGuest;
       die('-end-');*/
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     $model = new LoginForm();
     if ($model->vk_login() || $model->load(Yii::$app->request->post()) && $model->login()) {
         if (Yii::$app->user->can('7progress')) {
             return $this->redirect(['question/index']);
             // Yii::$app->request->referrer
         }
         /*if (Yii::$app->user->vk_id) {
               return $this->redirect('question/index'); // Yii::$app->request->referrer
               return $this->goBack();
           }*/
         return $this->goBack();
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }