Ejemplo n.º 1
0
 /**
  * Action for standard registration handling
  * @return string|Response
  * @throws ErrorException
  */
 public function actionSignup()
 {
     TagDependency::invalidate(Yii::$app->cache, ['Session:' . Yii::$app->session->id]);
     $model = new RegistrationForm();
     if ($model->load(Yii::$app->request->post())) {
         $user = $model->signup();
         if ($user !== null) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         } else {
             // there were errors
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
Ejemplo n.º 2
0
 public function actionRegister()
 {
     if (!$this->module->enableRegistration) {
         throw new NotFoundHttpException();
     }
     //        $model = \Yii::createObject(User::className());
     $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]);
 }
 /**
  * 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->redirect(['settings/profile']);
     }
     return $this->render('register', ['model' => $model, 'module' => $this->module]);
 }