Example #1
0
 public function actionRequestPasswordReset()
 {
     $model = new PasswordResetRequestForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($userId = $model->sendSms()) {
             Yii::$app->session->setFlash('success', 'Отправка sms с кодом для сброса пароля произведена.');
             return $this->redirect(['/account/auth/reset-password', 'id' => $userId]);
         } else {
             Yii::$app->session->setFlash('error', 'Извините произошла ошибка, мы не можем отправить Вам сообщение');
         }
     } else {
     }
     return $this->render('requestPasswordResetToken', ['model' => $model]);
 }
 /**
  * Requests password reset.
  *
  * @return mixed
  */
 public function actionRequestPasswordReset()
 {
     $model = new PasswordResetRequestForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail()) {
             Yii::$app->session->setFlash('success', Yii::t('frontend', 'Check your email for further instructions.'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('frontend', 'Sorry, we are unable to reset password for the provided email address.'));
         }
         return $this->refresh();
     }
     return $this->render('requestPasswordResetToken', ['model' => $model]);
 }