Symfony security redirect to login page
I would do this manually.
Make your route accessible by anonymous:
- { path: ^/panel, role: [IS_AUTHENTICATED_ANONYMOUSLY, ROLE_USER] }
In your template, check if there is a logged in user:
{% if app.user is null %} <!-- Then display your login form -->{% else %} <!-- Display the normal view -->{% endif %}
Or do it from the controller:
if (!is_object($this->get('security.token_storage')->getToken()->getUser())) { // Render the login form}
Like this, you can make your logic depending on that the user is authenticated or not.