dongmei8209 2011-06-29 22:32
浏览 52

禁用CakePHP中的会话重定向

On a CakePHP app when a user logs in, it redirects the user to either a previous visited action that requires authentication or to a default location specified by loginRedirect but all of this is hidden in the session value and stored until deleted.

I would like to disable this and instead replace it with query strings in the url such as for example domain.com/users/login?back?=/posts/add

This is to make sure the user always knows what they are trying to access and prevents them from being sent to locations that are saved in the session from previous visits and may not necessarily be the location they wish to visit...

Can anyone help? Thanks

EDIT: I have disbaled autoRedirect which DOES disable the Auth.redirect session key so now I need to build my own query string can anyone help with this?

  • 写回答

1条回答 默认 最新

  • dtt83024 2011-06-30 19:09
    关注

    in $this->Form->create() pass the url option with $this->referer() in it as a param, you will need to url encode it I guess.

    you can then pick it up again in the login action and use $this->redirect($thatParam) to do there.

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?