Commit 34bb29ef authored by Jozef Vajdiar's avatar Jozef Vajdiar
Browse files

Update RegistrationController.php

parent 24d50e3b
......@@ -70,6 +70,14 @@ class RegistrationController extends AbstractController
if ($form->isSubmitted()) {
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository(Users::class)->findOneBy(['email'=>$user->getEmail()]);
if ($user){
$this->addFlash('danger','Email is already registered!');
return new RedirectResponse($this->generateUrl('fos_user_registration_register'));
$event = new FormEvent($form, $request);
$this->eventDispatcher->dispatch($event, FOSUserEvents::REGISTRATION_SUCCESS);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment