public function testTooShortPassword()
 {
     $user = $this->tester->grabFixture('user', 'user-1');
     $form = new ResetPasswordForm();
     $form->password = '******';
     expect_that($form->validateToken($user->password_reset_token));
     expect_not($form->validate());
 }
Esempio n. 2
0
 /**
  * Reset password
  */
 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', 'New password was saved.');
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
Esempio n. 3
0
 /**
  * Reset password
  */
 public function actionResetPassword($token)
 {
     $userDriver = isset(\Yii::$app->params['user_driver']) == true && empty(\Yii::$app->params['user_driver']) == false ? \Yii::$app->params['user_driver'] : 'local';
     if ($userDriver != 'local') {
         throw new BadRequestHttpException(Yii::t('walle', 'the login type does not provide security', array('loginType' => $userDriver)));
     }
     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', 'New password was saved.');
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }
Esempio n. 4
0
 public function actionResetPassword($token)
 {
     $model = new ResetPasswordForm();
     if (!$model->validateToken($token)) {
         Yii::$app->session->setFlash('error', Yii::t('app.messages', 'Invalid link for reset password'));
         return $this->goHome();
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
         Yii::$app->session->setFlash('success', Yii::t('app', 'New password was saved'));
         return $this->goHome();
     }
     return $this->render('resetPassword', ['model' => $model]);
 }