Esempio n. 1
0
 public function run($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException($e->getMessage());
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         return Yii::$app->getResponse()->redirect(Url::to(['user/login']));
     }
     return $this->controller->render('resetPassword', ['model' => $model]);
 }
Esempio n. 2
0
 public function actionResetPassword($token)
 {
     try {
         $model = new ResetPasswordForm($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException($e->getMessage());
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->getSession()->setFlash('success', 'Новый пароль сохранен.');
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }