示例#1
0
 public function actionPasswordReset($token)
 {
     try {
         $model = new PasswordResetForm($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', Yii::t('user/flash', 'Passwords is changed'));
         return $this->goHome();
     }
     return $this->render('passwordReset', ['model' => $model]);
 }
示例#2
0
 public function actionPasswordReset($token)
 {
     try {
         $model = new PasswordResetForm($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', Module::t('module', 'FLASH_PASSWORD_RESET_SUCCESS'));
         return $this->goHome();
     }
     return $this->render('passwordReset', ['model' => $model]);
 }
 public function testResetCorrectToken()
 {
     $form = new PasswordResetForm($this->users[0]['password_reset_token']);
     expect('password should be resetted', $form->resetPassword())->true();
 }