code: protected function passwordRehash($username, Password $password)
      {
          $userData = $this->storage->getUserByName($username);
          
          try {
              $this->userDataEncodePassword($userData, $password);
          } catch (\PicoAuth\Security\Password\Encoder\EncoderException $e) {
              // The encoder was changed to one that is not able to store this password
              $this->session->addFlash("error", "Please set a new password.");
              $this->picoAuth->getContainer()->get('PasswordReset')->startPasswordResetSession($username);
              $this->picoAuth->redirectToPage("password_reset");
          }
          
          $this->storage->saveUser($username, $userData);
      }
docs: Performs a password rehash
  
  @param string $username User identifier
  @param Password $password The password to be resaved