FOSUserBundle _locale login_check not working as expected.

337 views
Skip to first unread message

James

unread,
Jun 3, 2012, 8:55:22 PM6/3/12
to friendsofs...@googlegroups.com
Hello,

Yesterday I started adding localization to my current project.  Things are 99% there, but I am having issues with logging in, and logging out.

Security.yml looks like this.
# app/config/security.yml
security:
    providers:
        fos_userbundle:
            id: fos_user.user_manager

    encoders:
        "FOS\UserBundle\Model\UserInterface": sha512

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                login_path:     /{_locale}/login 
                check_path:     /{_locale}/login_check
                default_target_path:    /{_locale}/manage
                csrf_provider: form.csrf_provider
            logout:
                path:   /{_locale}/logout
                target: /
            anonymous:    true

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/manage, role: ROLE_USER }
        - { path: ^/admin/, role: ROLE_ADMIN }

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

I first tried my routing like this.

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"
    prefix: /{_locale}

fos_user_profile:
    resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
    prefix: /{_locale}/profile

fos_user_register:
    resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
    prefix: /{_locale}/register

fos_user_resetting:
    resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
    prefix: /{_locale}/resetting
    
fos_user_change_password:
    resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
    prefix: /{_locale}/profile

This resulted in the error:

Bundle "@FOSUserBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your AppKernel.php file?

I am quite confused as to how to handle this, and I see no documentation in the FOSUserBundle docs section that covers it.  (or is at least noticeble from the links on the main docs page).

Any help would be greatly appreciated.

Thanks
James

James

unread,
Jun 3, 2012, 11:51:11 PM6/3/12
to friendsofs...@googlegroups.com
Searched a little longer and a little deeper and I found the answer.  Replaceds the paths with symfony routes cleared it up.  

            form_login:
                provider: fos_userbundle
                login_path:     fos_user_security_login 
                check_path:     fos_user_security_check
                default_target_path:    classkeeper_account_index
                csrf_provider: form.csrf_provider
Reply all
Reply to author
Forward
0 new messages