diff --git a/src/Controller/ResetPasswordController.php b/src/Controller/ResetPasswordController.php index fcfd24d..f6567a0 100644 --- a/src/Controller/ResetPasswordController.php +++ b/src/Controller/ResetPasswordController.php @@ -71,7 +71,7 @@ class ResetPasswordController extends AbstractController * Validates and process the reset URL that the user clicked in their email. */ #[Route('/reset/{token}', name: 'app_reset_password')] - public function reset(Request $request, UserPasswordHasherInterface $passwordHasher, string $token = null): Response + public function reset(Request $request, UserPasswordHasherInterface $passwordEncoder, string $token = null): Response { if ($token) { // We store the token in session and remove it from the URL, to avoid the URL being @@ -106,12 +106,13 @@ class ResetPasswordController extends AbstractController $this->resetPasswordHelper->removeResetRequest($token); // Encode the plain password, and set it. - $encodedPassword = $passwordHasher->encodePassword( - $user, - $form->get('plainPassword')->getData() + $user->setPassword( + $passwordEncoder->hashPassword( + $user, + $form->get('plainPassword')->getData() + ) ); - $user->setPassword($encodedPassword); $this->getDoctrine()->getManager()->flush(); // The session is cleaned up after the password has been changed. diff --git a/templates/reset_password/reset.html.twig b/templates/reset_password/reset.html.twig index 799aa10..6badfbb 100644 --- a/templates/reset_password/reset.html.twig +++ b/templates/reset_password/reset.html.twig @@ -6,7 +6,6 @@