login_check不是登錄頁面,它是執行登錄檢查腳本的路由 您是否檢查了您的security.yml文件以擁有適當的防火牆和提供程序等? 你需要有這樣的事情:
security:
providers:
in_memory:
memory: ~
fos_userbundle:
id: fos_user.user_provider.username_email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: .*
context: user
form_login:
success_handler: authentication_handler
failure_handler: authentication_handler
provider: fos_userbundle
csrf_provider: form.csrf_provider
login_path: /user/login
check_path: /user/login_check
default_target_path: /user/dashboard
always_use_default_target_path: true
logout:
path: /user/logout
target:/
anonymous: true
#fos security configurations
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMINROLE_ALLOWED_TO_SWITCH ]
access_control:
- { path: ^/user/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user/register, roles: [ ROLE_SUPER_ADMIN ] }
- { path: ^/user, roles: [ ROLE_USER, ROLE_SUPER_ADMIN ] }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
acl:
connection: default
謝謝你的回答。我正在使用/登錄頁面。重定向到/ login_check由FOS UserBundle完成。根和安全都是正確的。你有另一個想法嗎? – sdespont 2014-11-04 13:15:08
當我遇到FOS問題時,這是因爲AppKernel,cache,security.yml,services.yml,config.yml,管理員錯誤地導入資源,錯誤的orm,dbal設置,orm映射,實體管理器 – 2014-11-04 13:24:57