public function actionRegistration() { $model = new RegistrationForm(); if ($model->load(Yii::$app->request->post()) && $model->register()) { return $this->render('registration-success'); } return $this->render('registration', ['model' => $model]); }
public function actionRegistration() { if (!\Yii::$app->user->isGuest) { return $this->goHome(); } $model = new RegistrationForm(); if ($model->load(Yii::$app->request->post()) && $model->register()) { return $this->goBack(); } return $this->render('registration', ['model' => $model]); }
public function actionLogin() { if (!Yii::$app->user->isGuest) { return $this->goHome(); } $model = new LoginForm(); $registration_model = new RegistrationForm(); if ($model->load(Yii::$app->request->post(), 'LoginForm') && $model->login()) { return $this->goBack(); } if ($registration_model->load(Yii::$app->request->post(), 'RegistrationForm') && $registration_model->register()) { return $this->redirect('personal-details'); } return $this->render('login', ['model' => $model, 'registration_model' => $registration_model]); }
public function actionRegister() { if (!Yii::$app->user->isGuest) { return $this->goHome(); } $model = new RegistrationForm(); if ($model->load(Yii::$app->request->post()) && $model->register()) { Yii::$app->session->setFlash('success', 'Регистрация прошла успешно'); return $this->goHome(); } else { Yii::$app->session->setFlash('error', 'Возникла ошибка при регистрации'); Yii::error('Ошибка при регистрации'); } return $this->render('register', ['model' => $model]); }