diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 293e0b8..7deabb7 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -11,8 +11,8 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Mime\Address; +use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Annotation\Route; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; /** @@ -29,16 +29,16 @@ class RegistrationController extends AbstractController } #[Route('/register', name: 'app_register')] - public function register(Request $request, UserPasswordEncoderInterface $passwordEncoder): Response + public function register(Request $request, UserPasswordHasherInterface $passwordHasher): Response { $user = new User(); $form = $this->createForm(RegistrationFormType::class, $user); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { - // encode the plain password + // hash the plain password $user->setPassword( - $passwordEncoder->encodePassword( + $passwordHasher->hashPassword( $user, $form->get('plainPassword')->getData() )