Now redirecting logged in users to main page from registration form
This commit is contained in:
parent
3b911976d3
commit
837d93b14c
@ -5,6 +5,7 @@ namespace KekRozsak\SecurityBundle\Controller;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\Security\Core\SecurityContext;
|
use Symfony\Component\Security\Core\SecurityContext;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
use KekRozsak\FrontBundle\Entity\User;
|
use KekRozsak\FrontBundle\Entity\User;
|
||||||
use KekRozsak\FrontBundle\Form\Type\UserType;
|
use KekRozsak\FrontBundle\Form\Type\UserType;
|
||||||
@ -34,6 +35,11 @@ class DefaultController extends Controller
|
|||||||
|
|
||||||
public function registrationAction(Request $request)
|
public function registrationAction(Request $request)
|
||||||
{
|
{
|
||||||
|
$user = $this->get('security.context')->getToken()->getUser();
|
||||||
|
if ($user instanceof UserInterface)
|
||||||
|
{
|
||||||
|
return $this->redirect($this->generateUrl('KekRozsakFrontBundle_homepage'));
|
||||||
|
}
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$form = $this->createForm(new UserType(true), $user);
|
$form = $this->createForm(new UserType(true), $user);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user