I'm using Symfony 3.3 in conjunction with the JMSI18nRoutingBundle.
The bundle puts the user-locale in front of the routes. This works fine, untill I have to login or logout, these DO NOT work.
I always get the following error:
Unable to find the controller for path "/en/admin/logout". The route is wrongly configured.
This is part of my security.yml covering the login/logout:
security:
firewalls:
main:
anonymous: ~
pattern: ^.*/admin
form_login:
login_path: /{_locale}/admin/login
check_path: /{_locale}/admin/login
[...]
logout:
path: /{_locale}/admin/logout
target: /{_locale}/admin/login
access_control:
- { path: ^/admin/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin, roles: ROLE_ADMIN }
For the login_path, check_path, etc. I've also tried instead of {_locale}, .*, and just a slash (/) but none of these work.
The admin-logout is configured in my routing.yml:
admin-logout:
path: /admin/logout
This gets rendered in twig properly, when using path('admin-logout'), I get a URL with the locale in it, but when I click it, it just displays the above error message again. Login also doesn't work, I can however display the login page, but after entering credentials, it just refreshes the page without having logged in.
Anyone have any idea how to get the login/logout working again?
EDIT:
Thanks to nifr I could solve it, I should've used the route name, not the path in the security.yml, this is what I ended up with:
security:
firewalls:
main:
anonymous: ~
pattern: admin
form_login:
login_path: admin-login
check_path: admin-login
[...]
logout:
path: admin-logout
target: admin-login
[...]
I did not change anything in my routing.yml, as the JMSI18nRoutingBundle already puts the locale placeholder in front of the route (if you do put {_locale} there, you end up with routes like: /en/en/admin/)