/** * @inheritdoc */ public function actionRegister() { $model = new RegisterForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $registerStatus = $model->register(); } else { return $this->render('register', ['model' => $model]); } }
public function actionRegister() { $model = new RegisterForm(); if ($model->load(Yii::$app->request->post())) { if ($user = $model->register()) { if (Yii::$app->getUser()->login($user)) { return $this->goHome(); } } } return $this->render('register', ['model' => $model]); }
/** * @inheritdoc */ public function actionRegister() { $model = new RegisterForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->RegisterType = 3; $registerStatus = $model->register(); Yii::$app->getSession()->setFlash('success', 'Successfully Registered.'); // if ($model->sendEmail()) { // Yii::$app->getSession()->setFlash('success', 'Successfully Registered.'); // } else { // Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); // } //echo "Registration successfully"; return $this->render('register', ['model' => $model]); } return $this->render('register', ['model' => $model]); }
/** * /register * * @return string|\yii\web\Response */ public function actionIndex() { if ($this->member) { return $this->goHome(); } if (!$this->params['registrationsOpen']) { $this->notifyError('Registrations are currently closed'); return $this->goHome(); } $model = new RegisterForm(); $errors = null; if ($this->request->method == 'POST') { // populate model attributes with user inputs $model->load($this->request->post()); if ($model->validate() && $model->register()) { $this->notifySuccess('Complete your registration by opening the email sent to ' . $model->email); return $this->redirect('/login'); } else { // validation failed: $errors is an array containing error messages $errors = $model->errors; } } return $this->render('index', ['model' => $model, 'errors' => $errors]); }
public function testNotCorrectSignup() { $model = new RegisterForm(['username' => 'troy.becker', 'email' => '*****@*****.**', 'password' => 'some_password']); expect('username and email are in use, user should not be created', $model->register())->null(); }