I\'m using the FOSUserBundle and I require the ability to login from 2 different routes(or more). These routes will have different templates and also login to different area
I was stucked with the same question for a while and then i created a solution on my own. I knew there must be an easy solution...
I've submitted pull request which allows you to create new login templates more easily. Check the pull request here: https://github.com/FriendsOfSymfony/FOSUserBundle/pull/1186.
There is also another quite easy way how to achieve this. Extend SecurityController and change renderLogin method with following content
protected function renderLogin(array $data, $template)
{
return $this->container->get('templating')->renderResponse('YourBundle:Security:login.html.twig');
}
Then create a route to your newly created controller:
admin.login:
pattern: /admin/login
defaults: { _controller: YourBundle:Security:login }
After this only you have to do is to alter your security config accordingly. Change your form_login login_path to /admin/login and you are good to go.