public function actionSignup() { $model = new User(); $model->setScenario('signup'); if ($model->load($_POST) && $model->save()) { if (Yii::$app->getUser()->login($model)) { return $this->goHome(); } } return $this->render('signup', ['model' => $model]); }
/** * Creates a new User model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new User(); $model->scenario = 'create'; $model->status = User::STATUS_ACTIVE; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionSignup() { $model = new User(); $model->setScenario('signup'); if ($model->load($_POST)) { if ($model->save()) { if (Yii::$app->getUser()->login($model)) { return $this->goHome(); } } else { Yii::$app->getSession()->setFlash(Alert::TYPE_DANGER, Yii::t('gromver.platform', 'The form is filled incorrectly.')); } } $this->module->layout = $this->module->loginLayout; return $this->render('signup', ['model' => $model]); }