Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FOSUser bundle check_path with localization

How set login path with user locale? I tried

check_path: /{_locale}/login_check

and

check_path:     /(en|ru)/login_check

but nothing ((

Route config

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

Exception:

You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.

like image 500
rtyshyk Avatar asked Dec 26 '11 12:12

rtyshyk


2 Answers

Use routes instead of paths in the firewall configuration:

   security:
        firewalls:
            main:
                    form_login:
                        provider: fos_userbundle
                        login_path: fos_user_security_login
                        check_path: fos_user_security_check
                        csrf_provider: form.csrf_provider

link to topic in symfony forum

like image 125
martti Avatar answered Oct 05 '22 18:10

martti


Hm, i didn't recognized your prefix: /{_locale} under

resource: "@FOSUserBundle/Resources/config/routing/security.xml"

You should write route to your action in (for exmpl ofc) routing.yml:

login_check:
    pattern: /{_locale}/login_check
    defaults:  { _controller: YourBundle:Controller:someaction, _locale: en }
        requirements:
           _locale:  en|ru

and in security.xml:

check_path:  /{_locale}/login_check

Don't forget to add

fos_user_security:
    resource: "@FOSUserBundle/Resources/config/routing/security.xml"

in your app/config/routing.yml file.

try it, gl.

like image 34
DaunnC Avatar answered Oct 05 '22 19:10

DaunnC