Hi Dylan

Is there a reason you need to redirect rather than forward? If you had your preDispatch perform a _forward instead of a complete redirect then you could perform the login at the address /foo/bar instead of / login/index and there'd be no need to capture and re-assemble that url.

Alternatively you could use the FlashMessenger action helper to store such a URL and retrieve it after a successful login or re-set it every unsuccessful login to ensure it persists.

Hi all

When a user accesses a restricted page on my site and they have no identity a plugin in preDispatch sets the controller to login and action to index to render the page /login/index

This works fine. However I want to redirect to the url they were initially trying to access after they login.

I was thinking of doing something like this in the plugin.

$request->setParam('redirectController', $request- >getControllerName());
$request->setParam('redirectAction', $request->getActionName());

And then passing the data to a hidden field in my login form such as redirectUrl.

This gets complicated though. If I want to pass any keys/values.

I could do something like this.

$request->setParam('redirectParams', $request->getParams());

But this won't work for everything as I am using custom routes that fuddle up getParams(). Ie one of my routes overrides the /controller/ action/key/value/key/value scheme to /controller/action/value1/ value2/value3 and stores the values as an array in its own param.

So really I can't simply just iterate through getParams to build my redirect url.

I kind of want to access the requestUrl or pathInfo which I noticed is protected in the request object.

Then I can simply use this to redirect after a login. Is this possible and what is the difference between the two?

Does anybody have any ideas? Is there an alternate approach?

Hope this makes sense.

Thanks


--

Simon Mundy | Director | PEPTOLAB

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124
http://www.peptolab.com

Reply via email to