before change of user class

This commit is contained in:
tracer 2021-06-09 19:15:07 +02:00
parent c18d5dc339
commit 3a8b1c88c0

View File

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