0
votes

I would like to create new login form on my website using FOSUserBundle. The problem is that I don't know how to connect login page and check page...

I created login form:

<form action="{{ path("fos_user_security_check") }}" method="post">
  <input type="hidden" name="_csrf_token" value="{{ csrfToken }}" />

  <input type="text" name="_username" id="email" placeholder="Username" />
  <input type="password" name="_password" id="password" placeholder="Password" />
  <input type="checkbox" name="_remember_me" id="remember-me" />

  <input class="button" type="submit" name="_submit" value="Login!" />
</form>

My security.yml:

security:
    firewalls:
        main:
            pattern: ^/
            form_login:
                login_path: fos_user_security_login
                check_path: fos_user_security_check
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
                default_target_path: /
            logout:
                path: fos_user_security_logout
                target: my_bundle__homepage
            anonymous:    true

And if everything is fine, then Symfony redirect me on homepage - it's ok. But when user enter wrong username and password, then Symfony redirect him on default FOSUserBundle Check Login Page (fos_user_security_check). I want to change it and show error message on login page but I don't know how to do it... Any idea?

1

1 Answers

1
votes

You just need to set a route for:

failure_path

in the form_login section