How to get all users routed to one module and one action on logon in Symfony?

只谈情不闲聊 提交于 2019-12-08 04:16:09

问题


This follows on from my other question I posted.

I need to make it so that when anyone logs in they are redirected to a particular module - sfGuardUser and action isExistingUser. I know it is somehting to do with the routing, but I am absolutely clueless with this file, I can't make head nor tail of it, and none of the tutorials online are making any sense to me.

The problem is complicated (I think) further by the fact that if someone logs out (clicking a link logout) their url in the browser doesn't change, so therefore if they log on from that same screen, symfony tries to take them to whatever url they already have in their browser. I'm not sure how to account for this in my routing.

I have two apps - frontend and backend. I think users log in from the frontend (I'm not sure to be honest), but I think it's the frontend because when they login, they are taken to a module int he frontend app. Although looking at the settings.yml for both apps, the login module is enabled for both :S

Here is my routing file for the front end:

   homepage:
     url:   /
     param: { module: investigation, action: isExistingUser }

   default_index:
     url:   /:module
     param: { module: investigation, action: isExistingUser }

   default:
     url:   /:module/:action/*
     param: { module: investigation, action: isExistingUser }

And the backend:

homepage:
   url:   /
   param: { module: sfGuardUser, action: index }

sfGuardUser:
   url:   /sf_guard_user
   param: { module: sfGuardUser, action: index }

default_index:
   url:   /:module
   param: { action: index }

default:
   url:   /:module/:action/*

回答1:


you set the route used after sign_in or sign_out in the app.yml for each project.

For example in apps/(backend|frontend)/config/app.yml:

all:
  sf_guard_plugin:
    success_signin_url:      @my_route?param=value # the plugin use the referer as default
    success_signout_url:     module/action         # the plugin use the referer as default

found in the extra documentation of sfguardplugin ;)



来源:https://stackoverflow.com/questions/6370230/how-to-get-all-users-routed-to-one-module-and-one-action-on-logon-in-symfony

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!