The URL would look something like this:
/login?to=/dashboard
I also experimented with a hidden field but I ended up switching to using
the $_GET parameter because it gave me flexibility to create hyperlinks:
<a href="/login?to=/dashboard">Login To Dashboard</a>
<a href="/login?to=/profile">Login To Profile</a>
The hidden field would also work if you use $this->_request->getParam('to'),
so it's up to when it comes to the controller plugin redirect.
Also, I suggest storing the 'to' param in the session (from within your
AuthController) in case the user supplies a bad password. This way you don't
lose the parameter in case they fail to log in on the first attempt.
--
Hector
On Thu, Oct 8, 2009 at 2:20 PM, David Mintz <[email protected]> wrote:
>
>
> On Thu, Oct 8, 2009 at 4:28 PM, Hector Virgen <[email protected]> wrote:
>
>> I found it better to use a $_GET parameter for this. This allows you to
>> create hyperlinks out of the URL that redirects the user to a specific page
>> after logging in.
>>
>>
>>
> Not sure I follow. You would put this GET parameter... where? Append it to
> the login form's action attribute (url-encoding any slashes in the URI you
> want to redirect to)? How's that different from putting in a hidden field,
> ultimately?
>
>
>
> --
> David Mintz
> http://davidmintz.org/
>
> The subtle source is clear and bright
> The tributary streams flow through the darkness
>