{"issue":{"user":{"id":678221,"login":"NeuralClone","url":"https://api.github.com/users/NeuralClone","gravatar_id":"61d655ff61dd10e921aeef550ff406b5","avatar_url":"https://secure.gravatar.com/avatar/61d655ff61dd10e921aeef550ff406b5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"milestone":null,"created_at":"2011-12-20T20:39:04Z","title":"Locale not being prefixed when redirecting to /login*","updated_at":"2011-12-20T22:39:25Z","labels":[],"state":"closed","id":2617908,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/schmittjoh/JMSI18nRoutingBundle/issues/15","closed_at":"2011-12-20T22:10:17Z","number":15,"body":"Hi,\r\n\r\nI seem to be having an issue using the prefix strategy when using this bundle with Symfony 2.0.7 (standard edition). I'm not sure if this is an issue with the bundle, a change in FOSUserBundle (I use that as my user provider), or a change in Symfony itself.\r\n\r\nThe locale is correctly prefixed in all of my routes *except* when trying to directly access the secured section of my site when not logged in. Instead of redirecting to `/{_locale}/login`, I keep getting redirected to `/login`, which causes Symfony to throw a `NotFoundHttpException` due to the route not existing.\r\n\r\nFor example, if a user tries to access `/en/members` before they've logged in, it redirects them to `/login` instead of `/en/login`. The same thing happens when trying to access `/fr/members/`. As far as I can tell, this is a fairly new problem that just started in Symfony 2.0.7. It may also impact 2.0.6 but I haven't tested it on that version. I'm pretty confident that it was working in 2.0.6.\r\n\r\nPresumably there's an issue with the way I have my firewall configured or there's an issue with another part of my configuration. This does seem a bit odd though since the locale is correctly prefixed in every other situation (as far as I can tell).\r\n\r\nIn config.yml:\r\n\r\n    jms_i18n_routing:\r\n        default_locale: %locale%\r\n        locales: [en, fr]\r\n        strategy: prefix\r\n\r\nIn my security.yml:\r\n\r\n    firewalls:\r\n        frontend:\r\n            pattern: ^/.*\r\n            provider: fos_userbundle\r\n            form_login:\r\n                check_path: /login_check\r\n                login_path: /login\r\n            logout:\r\n                path: /logout\r\n                target: /\r\n            anonymous: true\r\n\r\n    access_control:\r\n        - { path: ^/[a-z][a-z]/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }\r\n        - { path: ^/[a-z][a-z]/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }\r\n        - { path: ^/[a-z][a-z]/members, role: ROLE_MEMBER }\r\n        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY}\r\n\r\nAfter running `php app/console router:debug` I get the following security routes:\r\n\r\n    en_fos_user_security_login           ANY      /en/login\r\n    fr_fos_user_security_login           ANY      /fr/login\r\n    en_fos_user_security_check           ANY      /en/login_check\r\n    fr_fos_user_security_check           ANY      /fr/login_check\r\n    en_fos_user_security_logout          ANY      /en/logout\r\n    fr_fos_user_security_logout          ANY      /fr/logout\r\n\r\nI've currently implemented a simple workaround that allows users to login without an exception being thrown by explicitly setting the default locale in my firewall:\r\n\r\n    firewalls:\r\n        frontend:\r\n            pattern: ^/.*\r\n            provider: fos_userbundle\r\n            form_login:\r\n                check_path: /%locale%/login_check\r\n                login_path: /%locale%/login\r\n            logout:\r\n                path: /%locale%/logout\r\n                target: /\r\n            anonymous: true\r\n\r\nBut as you can imagine, this is less than ideal since it *always* uses the default locale when prompting users to login. Thanks for your help and/or input.\r\n\r\nKeep up the great work. This bundle has saved me tons of development time. :)","url":"https://api.github.com/repos/schmittjoh/JMSI18nRoutingBundle/issues/15","comments":5,"assignee":null},"comment":{"user":{"id":678221,"login":"NeuralClone","url":"https://api.github.com/users/NeuralClone","gravatar_id":"61d655ff61dd10e921aeef550ff406b5","avatar_url":"https://secure.gravatar.com/avatar/61d655ff61dd10e921aeef550ff406b5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2011-12-20T22:39:25Z","updated_at":"2011-12-20T22:39:25Z","id":3226608,"body":"@stof Thanks. That occurred to me right after posting my response. I didn't\nupdate it since the issue was closed. Removing the pattern and slashes\nfixed the problem. Thanks again.\n\n@schmittjoh My apologies. I only posted this here because I legitimately\nthought this was an issue with the bundle and not my configuration. It\nwon't happen again. (I also can't post to the Symfony2 mailing list. It\njust says my post needs to be approved and it never goes beyond that step.\nThis has been a problem for me since the mailing list was split.)","url":"https://api.github.com/repos/schmittjoh/JMSI18nRoutingBundle/issues/comments/3226608"},"action":"created"}