开发者

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

开发者 https://www.devze.com 2023-03-13 04:43 出处:网络
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 somehtin

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/*


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 ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消