Hi Dylan
you might want to look at my earlier post (http://www.nabble.com/how- to-add-auth--t2907053s16154.html#a8123139 ) where I outlined my solution to this same problem. I'm not sure if it's the best way of doing it but it worked for me...
Tony

On 10 Jul 2007, at 10:11, Dylan Arnold wrote:

Hi Simon,

The login page does show up at /foo/bar . But the form submits to / login/index
At which point the original url is lost. I'm using quickform here too.

I'm not really redirecting to display the login page I don't think. In preDispatch all I do is override what controller (login) and action (index) to run. So I am getting to the login action whilst at /foo/bar . The problem is in the form submission submitting to /login/index . I need it to submit to that url and then redirect back to /foo/bar/ whatever/values

I suppose in the login action I could get the url (how do you do this?) and pass that around with flashmessenger or in a hidden field in the login form.

Cheers

On 7/10/07, Simon Mundy <[EMAIL PROTECTED]> wrote:
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