找不到Symfony2 sudenly登录路由

时间:2014-10-04 10:56:47

标签: php symfony exception login

今天早上我在控制器上写了一些新功能并且工作得很好但是在10分钟后突然试图访问Symfony告诉我的方法之一:“找不到”GET / login“的路由,即使我尝试访问app.php也对我说同样的例外。

在这个项目中,我使用路由@Route和routing.yml文件

下面我将展示我的配置

路由的文件

  

应用/配置/ routing.yml中

     

FRAB:       资源:“@ FrabApiBundle / Resources / config / routing.yml”

     

frab_routting:       资源:“@ FrabApiBundle / Controller”       type:annotation       前缀:/

     

fos_user_security:        资源:“@ FOSUserBundle / Resources / config / routing / security.xml”        前缀:admin         fos_user_profile:        资源:“@ FOSUserBundle / Resources / config / routing / profile.xml”        前缀:/ profile

     

fos_user_register:       资源:“@ FOSUserBundle / Resources / config / routing / registration.xml”       前缀:/ register

     

fos_user_resetting:       资源:“@ FOSUserBundle / Resources / config / routing / resetting.xml”       前缀:/ resetting

     

fos_user_change_password:       资源:“@ FOSUserBundle / Resources / config / routing / change_password.xml”       前缀:/ profile

安全文件

  

应用/配置/ security.yml

     

安全性:       编码器:           FOS \ UserBundle \ Model \ UserInterface:sh​​a512

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

providers:
    fos_userbundle:
      id: fos_user.user_provider.username
      id: fos_user.user_provider.username_email

firewalls:
    dev:
        pattern:  ^/(_(profiler|wdt)|css|images|js)/
        security: false

    dashboard:
        pattern:  ^/
        security: true
        form_login:
            provider: fos_userbundle
            check_path: /admin/login_check
            login_path: /login
            default_target_path: /ds
            csrf_provider: form.csrf_provider
        logout:
            path: /ds/logout
            target: /ds
        anonymous: ~

access_control:
    - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: http }
    - { path: ^/ds, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/ds/users, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/ds/groups, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/ds/photos, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/ds/mail, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/ds/sendmail, roles: ROLE_SUPER_ADMIN, requires_channel: http }
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: http }
    - { path: ^/login_check, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: http }

我该怎么办?

1 个答案:

答案 0 :(得分:0)

您已将admin前缀添加到@FOSUserBundle/Resources/config/routing/security.xml资源,因此您的登录路径(fos_user_security_login)现在位于/admin/login