public function actionRequestPasswordReset() { $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.'); return $this->goHome(); } else { Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); } } return $this->render('requestPasswordResetToken', ['model' => $model]); }
public function actionRepass() { $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->getSession()->setFlash('repass-success', 'На Email выслано письмо с дальнейшими инструкциями.'); } else { Yii::$app->getSession()->setFlash('repass-error', 'Ошибка восстановления пароля. Обратитесь к администратору.'); } return $this->redirect(['/repass']); } return $this->render('requestPasswordResetToken', ['model' => $model]); }
/** * Generate and send token to user's email for resetting password. * * @return string|\yii\web\Response */ public function actionRequestPasswordReset() { // Change layout and body class of register page $this->layout = 'blank'; Yii::$app->params['bodyClass'] = 'register-page'; $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail()) { Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.'); return $this->goHome(); } else { Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); } } return $this->render('request-password-reset-token', ['model' => $model]); }
public function actionForgot_password() { $this->layout = 'login'; $model = new PasswordResetRequestForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendMail()) { Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.'); return $this->redirect(Yii::$app->urlManager->createAbsoluteUrl('site/login')); } else { Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.'); } } return $this->render('requestPasswordResetToken', ['model' => $model]); }