public function actionRegistration()
 {
     $model = new RegistrationForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->register()) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('registration', ['model' => $model]);
 }
 public function actionRegister()
 {
     $model = Yii::createObject(RegistrationForm::className());
     $this->performAjaxValidation($model);
     if ($model->load(Yii::$app->request->post())) {
         if ($model->register()) {
             return $this->render('/message', ['title' => Yii::t('user', 'Your account has been created'), 'module' => $this->module]);
         }
     }
     return $this->render('register', ['model' => $model, 'module' => $this->module]);
 }
Ejemplo n.º 3
0
 /**
  * Displays the registration page.
  * After successful registration if enableConfirmation is enabled shows info message otherwise redirects to home page.
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionRegister()
 {
     if (!$this->module->enableRegistration) {
         throw new NotFoundHttpException();
     }
     /** @var RegistrationForm $model */
     $model = Yii::createObject(RegistrationForm::className());
     $this->performAjaxValidation($model);
     if ($model->load(Yii::$app->request->post()) && $model->register()) {
         return $this->render('/message', ['title' => Yii::t('user', 'Your account has been created'), 'module' => $this->module]);
     }
     return $this->render('register', ['model' => $model, 'module' => $this->module]);
 }