Exemplo n.º 1
0
 public function actionLogin()
 {
     if (!\Yii::$app->user->isGuest) {
         return $this->goHome();
     }
     //        $model = new LoginForm();
     $model = new AuthUser();
     if ($model->load(Yii::$app->request->post()) && $model->login()) {
         //            echo "<pre>" . print_r($model,1) . "</pre>";
         //            echo 'login true';
         //die('login true');
         return $this->goBack();
     }
     return $this->render('login', ['model' => $model]);
 }
Exemplo n.º 2
0
 /**
  * Creates a new AuthUser model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     /** @var AuthUser $model */
     $model = new AuthUser();
     return $model->load(Yii::$app->request->post()) && $model->validate() && $this->saveAvatar($model) && $model->save() ? $this->redirect(['index']) : $this->render('create', ['model' => $model]);
 }