removed encoder, set hasher

This commit is contained in:
tracer 2021-06-13 16:09:30 +02:00
parent 613605ef92
commit 99e6e4a702

View File

@ -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()
)