开发者

Disable Session redirect in 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 开发者_如何学Pythonspecified 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?


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜