From a3bd7bf42309076dc5ece8a8cf1df3b17ef545b6 Mon Sep 17 00:00:00 2001 From: thisfro Date: Mon, 27 Dec 2021 15:02:55 +0100 Subject: [PATCH] Fix registration issues --- src/Controller/RegistrationController.php | 8 +++----- templates/registration/created.html.twig | 9 +++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 templates/registration/created.html.twig diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 5b7364c..65e17d8 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -35,7 +35,7 @@ class RegistrationController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { // encode the plain password $user->setPassword( - $passwordEncoder->encodePassword( + $passwordEncoder->hashPassword( $user, $form->get('plainPassword')->getData() ) @@ -54,7 +54,7 @@ class RegistrationController extends AbstractController ->htmlTemplate('registration/confirmation_email.html.twig') ); - return $this->redirectToRoute('security'); + return $this->render('registration/created.html.twig'); } return $this->render('registration/register.html.twig', [ @@ -72,13 +72,11 @@ class RegistrationController extends AbstractController $this->emailVerifier->handleEmailConfirmation($request, $this->getUser()); } catch (VerifyEmailExceptionInterface $exception) { $this->addFlash('verify_email_error', $exception->getReason()); - return $this->redirectToRoute('app_register'); } // @TODO Change the redirect on success and handle or remove the flash message in your templates $this->addFlash('success', 'Your email address has been verified.'); - - return $this->redirectToRoute('app_register'); + return $this->redirectToRoute('user_page'); } } diff --git a/templates/registration/created.html.twig b/templates/registration/created.html.twig new file mode 100644 index 0000000..3877529 --- /dev/null +++ b/templates/registration/created.html.twig @@ -0,0 +1,9 @@ +{% extends 'base.html.twig' %} + +{% block title %}Account created{% endblock %} + +{% block body %} +

Your account has been created!

+ +

Check your inbox for the verification email!

+{% endblock %}