/** * Register the user * * @return string|\yii\web\Response */ public function actionRegister() { $model = new User(); $model->scenario = 'register'; if ($model->load(Yii::$app->request->post()) && $model->register(FALSE, User::STATUS_PENDING)) { // Send Welcome Message to activate the account Mailer::sendWelcomeMessage($model); Yii::$app->session->setFlash('success', Yii::t('user', 'You\'ve successfully been registered. Check your mail to activate your account')); return $this->redirect(Yii::$app->urlManager->createUrl('//user/auth/login')); } return $this->render('register', ['model' => $model]); }
/** * Setup Administrative User * * This should be the last step, before the user is created also the * application secret will created. */ public function actionAdmin() { $model = new User(); $profile = new Profile(); $model->scenario = 'register'; if ($model->load(Yii::$app->request->post())) { if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($model); } if ($model->register(TRUE)) { return $this->redirect(Yii::$app->urlManager->createUrl('//installer/config/finished')); } } return $this->render('admin', ['model' => $model, 'profile' => $profile]); }