Example #1
0
 /**
  * Unsuspend the user and give him a new password
  *
  * @param User $user
  * @param string $reset_code The password reset code
  * @throws PasswordResetFailedException
  * @return string Returns the new password on success
  */
 protected function unsuspendUserAndResetPassword($user, $reset_code)
 {
     $throttle = $this->sentry->findThrottlerByUserId($user->getId());
     $throttle->unsuspend();
     $new_password = $this->mockably->str_random(16);
     if ($user->attemptResetPassword($reset_code, $new_password)) {
         return $new_password;
     } else {
         throw new PasswordResetFailedException();
     }
 }