如何在用戶登錄後重定向?爲什麼我的代碼無法工作? 這裏我security.yml登錄後重定向fos用戶symfony
main:
pattern: ^/
form_login:
provider: fos_userbundle
login_path: /login
check_path: /login_check
always_use_default_target_path: false
# default_target_path: /home
# target_path_parameter: _target_path
# use_referer: false
oauth:
failure_path: /login
login_path: /login
check_path: /login
provider: fos_userbundle
resource_owners:
facebook: "/login/check-facebook"
oauth_user_provider:
# service: hwi_oauth.user.provider.fosub_bridge
service: project_home_userprovider
anonymous: ~
logout:
path: /logout
target: /login
access_control:
- { path: ^/login$, roles: [IS_AUTHENTICATED_ANONYMOUSLY] }
- { path: ^/admin, roles: [ROLE_ADMIN] }
- { path: ^/murid, roles: [ROLE_MURID] }
我這裏路由
murid:
resource: "@muridBundle/Resources/config/routing.yml"
prefix: /
admin:
resource: "@adminBundle/Resources/config/routing.yml"
prefix: /admin
home:
resource: "@homeBundle/Resources/config/routing.yml"
prefix: /
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
hwi_oauth_security:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /login
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /login
facebook_login:
pattern: /login/check-facebook
登錄成功後,它總是直接到symfony的主頁..不能ü幫助我嗎?如何重定向到具有不同ROLE的另一個頁面?
他使用的是FOSUserBundle,而不是標準的Symfony登錄表單。 – darkbluesun