before change of user class

This commit is contained in:
tracer 2021-06-09 19:15:07 +02:00
parent c18d5dc339
commit 3a8b1c88c0
1 changed files with 10 additions and 6 deletions

View File

@ -15,6 +15,10 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
/**
* Class RegistrationController
* @package App\Controller
*/
class RegistrationController extends AbstractController class RegistrationController extends AbstractController
{ {
private $emailVerifier; private $emailVerifier;
@ -67,14 +71,14 @@ class RegistrationController extends AbstractController
{ {
$id = $request->get('id'); $id = $request->get('id');
if (null === $id) { if ($id === null) {
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('app_login');
} }
$user = $userRepository->find($id); $user = $userRepository->find($id);
if (null === $user) { if ($user === null) {
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('app_login');
} }
// validate email confirmation link, sets User::isVerified=true and persists // validate email confirmation link, sets User::isVerified=true and persists
@ -83,12 +87,12 @@ class RegistrationController extends AbstractController
} catch (VerifyEmailExceptionInterface $exception) { } catch (VerifyEmailExceptionInterface $exception) {
$this->addFlash('verify_email_error', $exception->getReason()); $this->addFlash('verify_email_error', $exception->getReason());
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('app_login');
} }
// @TODO Change the redirect on success and handle or remove the flash message in your templates // @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.'); $this->addFlash('success', 'Your email address has been verified.');
return $this->redirectToRoute('app_register'); return $this->redirectToRoute('blogs');
} }
} }