Fix registration issues

This commit is contained in:
Jannis Portmann 2021-12-27 15:02:55 +01:00
parent 4260034fbe
commit a3bd7bf423
2 changed files with 12 additions and 5 deletions

View file

@ -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');
}
}

View file

@ -0,0 +1,9 @@
{% extends 'base.html.twig' %}
{% block title %}Account created{% endblock %}
{% block body %}
<h1>Your account has been created!</h1>
<p>Check your inbox for the verification email!</p>
{% endblock %}