namespace MyUserBundle\Controller;
use FOS\UserBundle\Controller\SecurityController as ParentSecurityController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
class SecurityController extends ParentSecurityController
{
public function loginAction(Request $request)
{
if (!$this->container->get('security.context')->isGranted('IS_AUTHENTICATED_ANONYMOUSLY'))
{
return new RedirectResponse('/');
}
return parent::loginAction($request);
}