From 1fd1d2e2cd882627a2c914632e79100fcd51dc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20Perron?= Date: Fri, 31 Jan 2025 19:20:18 -0500 Subject: [PATCH] feat: auto-verify user when they reset their password --- src/Controller/Public/ResetPasswordController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Controller/Public/ResetPasswordController.php b/src/Controller/Public/ResetPasswordController.php index 59ecca2d..a669c272 100644 --- a/src/Controller/Public/ResetPasswordController.php +++ b/src/Controller/Public/ResetPasswordController.php @@ -93,6 +93,7 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas } try { + /** @var User */ $user = $this->resetPasswordHelper->validateTokenAndFetchUser($token); } catch (ResetPasswordExceptionInterface $e) { $this->addFlash('reset_password_error', sprintf( @@ -118,6 +119,9 @@ public function reset(Request $request, UserPasswordHasherInterface $passwordHas ); $user->setPassword($encodedPassword); + // If you went through the password reset process, your email is verified + $user->setIsVerified(true); + $this->entityManager->flush(); // The session is cleaned up after the password has been changed.