Symfony2 Authentication "login_check" path not found
I would recomend that you use the FOSUserBundle as this seems the quickest way to do what you would like to do: FOSUserBundle
Installation is very straight-forward and would allow you to get your app working in a very short amount of time. Good luck!
EDIT:
Could you post your controller TestCompanyInternetBundle:Admin:login? Does you controller extend the security controller at all?
teuneboon
Experienced developer(for my age at least), interested in Java, PHP and javascript and always looking into new techniques.
Updated on June 04, 2022Comments
-
teuneboon almost 2 years
I'm new to Symfony2 and I'm trying to create a basic registration + login system. So, with the help of the Symfony2 documentation I created this security.yml:
security: encoders: TestCompany\InternetBundle\Entity\Member: algorithm: sha1 encode_as_base64: false iterations: 1 role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ] providers: administrators: entity: { class: TestCompanyInternetBundle:Member, property: username } firewalls: admin_area: pattern: ^/admin anonymous: ~ form_login: login_path: /login check_path: /login_check access_control: - { path: ^/admin, roles: ROLE_ADMIN }
and I used this routing for it:
login_check: pattern: /login_check login: pattern: /login defaults: { _controller: TestCompanyInternetBundle:Admin:login }
According to http://symfony.com/doc/current/book/security.html#using-a-traditional-login-form I do NOT need to implement a controller for the login_check route. Yet, Symfony returns this error to me:
Unable to find the controller for path "/login_check". Maybe you forgot to add the matching route in your routing configuration?
Do you see anything I could have done wrong here? The login page is almost an exact copy of the one used in the documentation. The error occurs on the page:
http://localhost/SymfonyTest/web/app_dev.php/login_check
, which is the page I get sent to after using the login form.