From 99e6e4a70238b3019e82a0bc24631e1e79b21fb6 Mon Sep 17 00:00:00 2001 From: tracer Date: Sun, 13 Jun 2021 16:09:30 +0200 Subject: [PATCH] removed encoder, set hasher --- src/Controller/RegistrationController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() )