Now redirecting logged in users to main page from registration form

This commit is contained in:
Polonkai Gergely 2012-07-07 20:56:04 +02:00
parent 3b911976d3
commit 837d93b14c
1 changed files with 6 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace KekRozsak\SecurityBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\UserInterface;
use KekRozsak\FrontBundle\Entity\User;
use KekRozsak\FrontBundle\Form\Type\UserType;
@ -34,6 +35,11 @@ class DefaultController extends Controller
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();
$form = $this->createForm(new UserType(true), $user);