diff --git a/src/Resources/skeleton/registration/RegistrationController.tpl.php b/src/Resources/skeleton/registration/RegistrationController.tpl.php index 77969a1cf..ad3707910 100644 --- a/src/Resources/skeleton/registration/RegistrationController.tpl.php +++ b/src/Resources/skeleton/registration/RegistrationController.tpl.php @@ -20,13 +20,11 @@ public function register(Request $request, UserPasswordHasherInterface $userPass $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var string $plainPassword */ + $plainPassword = $form->get('plainPassword')->getData(); + // encode the plain password - $user->set( - $userPasswordHasher->hashPassword( - $user, - $form->get('plainPassword')->getData() - ) - ); + $user->set($userPasswordHasher->hashPassword($user, $plainPassword)); $entityManager->persist($user); $entityManager->flush(); @@ -36,7 +34,7 @@ public function register(Request $request, UserPasswordHasherInterface $userPass $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user, (new TemplatedEmail()) ->from(new Address('', '')) - ->to($user->()) + ->to((string) $user->()) ->subject('Please Confirm your Email') ->htmlTemplate('registration/confirmation_email.html.twig') ); @@ -84,7 +82,11 @@ public function verifyUserEmail(Request $requestemailVerifier->handleEmailConfirmation($request, getUser()' ?>); + + /** @var $user */ + $user = $this->getUser(); + + $this->emailVerifier->handleEmailConfirmation($request, $user); } catch (VerifyEmailExceptionInterface $exception) { $this->addFlash('verify_email_error', $translator->trans($exception->getReason(), [], 'VerifyEmailBundle')$exception->getReason()); diff --git a/src/Resources/skeleton/verifyEmail/EmailVerifier.tpl.php b/src/Resources/skeleton/verifyEmail/EmailVerifier.tpl.php index 5c0864efd..f5e37f7f2 100644 --- a/src/Resources/skeleton/verifyEmail/EmailVerifier.tpl.php +++ b/src/Resources/skeleton/verifyEmail/EmailVerifier.tpl.php @@ -19,10 +19,10 @@ public function sendEmailConfirmation(string $verifyEmailRouteName, (), - $user->(), + (string) $user->(), ['id' => $user->()] - $user->() + (string) $user->() ); @@ -41,7 +41,7 @@ public function sendEmailConfirmation(string $verifyEmailRouteName, $user): void { - $this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->(), $user->()); + $this->verifyEmailHelper->validateEmailConfirmationFromRequest($request, (string) $user->(), (string) $user->()); $user->setVerified(true); diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php index 962473b6a..97e5428e7 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerCustomAuthenticator.php @@ -23,13 +23,11 @@ public function register(Request $request, UserPasswordHasherInterface $userPass $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var string $plainPassword */ + $plainPassword = $form->get('plainPassword')->getData(); + // encode the plain password - $user->setPassword( - $userPasswordHasher->hashPassword( - $user, - $form->get('plainPassword')->getData() - ) - ); + $user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword)); $entityManager->persist($user); $entityManager->flush(); diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php index c42816f1b..1fd6787d8 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerFormLogin.php @@ -22,13 +22,11 @@ public function register(Request $request, UserPasswordHasherInterface $userPass $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var string $plainPassword */ + $plainPassword = $form->get('plainPassword')->getData(); + // encode the plain password - $user->setPassword( - $userPasswordHasher->hashPassword( - $user, - $form->get('plainPassword')->getData() - ) - ); + $user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword)); $entityManager->persist($user); $entityManager->flush(); diff --git a/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php b/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php index 1f29555f5..8863f9342 100644 --- a/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php +++ b/tests/fixtures/make-registration-form/expected/RegistrationControllerNoLogin.php @@ -21,13 +21,11 @@ public function register(Request $request, UserPasswordHasherInterface $userPass $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + /** @var string $plainPassword */ + $plainPassword = $form->get('plainPassword')->getData(); + // encode the plain password - $user->setPassword( - $userPasswordHasher->hashPassword( - $user, - $form->get('plainPassword')->getData() - ) - ); + $user->setPassword($userPasswordHasher->hashPassword($user, $plainPassword)); $entityManager->persist($user); $entityManager->flush();