0

To use the application which I implement the user must login first. The login form appears on the "/" url.

So I create the following "security.yml".

security:
    access_decision_manager:
        strategy: unanimous
    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
        secured_area:
            pattern:    ^/
            anonymous: ~
            form_login:
                login_path: login
                check_path: login_check
                csrf_provider: form.csrf_provider
                success_handler: app_user_handler_login
                failure_handler: app_user_handler_login
            logout:
                path:   /logout
                target: /
            switch_user: {role: ROLE_ADMIN}
    providers:
        administrators:
            entity: { class: AppUserBundle:User, property: username }

    encoders:
        App\UserBundle\Entity\User: 
            algorithm: bcrypt

    role_hierarchy:
        ROLE_USER: ~
        ROLE_TEACHER: [ROLE_USER]
        ROLE_EDITOR: [ROLE_TEACHER]
        ROLE_ADMIN: [ROLE_EDITOR]

My routing file have the following content.

login:
    path:     /
    defaults: { _controller: AppSecurityBundle:Default:index}

login_check:
    path: /login_check

logout:
    path: /logout

Now if i call the url "/app_dev.php/" the login form appears and if i enter a valid username with password i receive the following error.

"No route found for "POST //login_check"

But if i call the url "/" or "/app_dev.php" everything is ok, how can i solve this problem?

Cœur
  • 37,241
  • 25
  • 195
  • 267
smartcoderx
  • 1,021
  • 2
  • 14
  • 32
  • Shouldn't the login_path and check_path be preceded with a "/" like the logout path? – costa Nov 18 '14 at 10:58
  • There are several questions already about this: http://stackoverflow.com/questions/20950149/unable-to-find-the-controller-for-path-login-check-symfony2 http://stackoverflow.com/questions/10866123/symfony2-authentication-login-check-path-not-found – costa Nov 18 '14 at 11:01
  • This solve my problem partially. Now i can successfull login but i do not understand why the "/" exists as trailing slash after "app_dev.php" this trigger another problem with the profiler. On the prod enviorment the trailing slash not exisits and everything is fine. – smartcoderx Nov 19 '14 at 06:18

0 Answers0