I am relatively new to Symfony 2 but I have a site with many different sub domains and user areas that I would like my login page styled differently, but currently it is not. I am using Symfony 2 and the FOS UserBundle and everything is currently working properly with 1 firewall in security.yml. I a overriding the FOS UserBundle Layout per the documentation, but I would like to be able to style that page differently depending on where the request is coming from, for example: microsite1.mainsite.com/user gets Style A microsite1.mainsite.com/admin gets Style B microsite2.mainsite.come/user gets Style C
I have considered a few options and I'm looking for other opinions. The first option I had considered was overriding/extending the controllers in the FOS UserBundle so that the referrer could be identified and a different twig template rendered. Another option was to use a different firewall for the different routes, but we really want to be able to have users in different microsites authenticated across all sites so one firewall is preferred. Are there any other solutions to this, or is there one way more preferable than another to tackle this relatively minor issue?
You can override the
renderLogin
method of theSecurityController
. Here is how you could do it: