コード例 #1
0
 /**
  * Resets password.
  *
  * @param string $token
  * @return mixed
  * @throws BadRequestHttpException
  */
 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->session->setFlash('success', 'New password was saved.');
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
コード例 #2
0
ファイル: ResetPasswordFormTest.php プロジェクト: gtyd/jira
 public function testResetCorrectToken()
 {
     $form = new ResetPasswordForm($this->user[0]['password_reset_token']);
     expect('password should be resetted', $form->resetPassword())->true();
 }