[Catalyst] process a restored request

Bill Moseley moseley at hank.org
Wed Aug 4 19:09:51 GMT 2010


On Wed, Aug 4, 2010 at 11:22 AM, Steve <steve at matsch.com> wrote:

> Original post:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg01222.html
>
> My apologies for rehashing this old post, but this is such a *nice* thing
> to do for users that
> I'm sort of surprised the solution hasn't been implemented as a plugin or
> something, at least
> so far as I can tell...
>
> I'm trying to implement this elegant solution, but am getting stuck with
> the
>
> 'just dump any POST data back out into
> hidden fields in the login form, don't change the URL, and have the login
> form processed in a forward() from auto or similar rather than doing a
> detach' part.
>

I think the suggestion was in auto always check if authenticated.  If not
authenticated, then attempt to authenticate with existing form data (e.g. if
a username and password have been posted).  if that succeeds then just
continue on to the requested action.

If cannot authenticate then display a login form but also include all other
parameters that were posted in hidden fields.  Set the action to post back
to the original action.

Repeat.

You probably want to track the original request method (GET POST PUT DELETE)
so that when the form is submitted (and finally authenticated) your action
sees the original request method.

If there's upload data then you would need to handle that additionally.



>
> My questions are as follows:
> What hidden field or fields are in the login form?
>

One for each posted parameter.



> Where in the code sample are the items stashed? (or are they stored
> elsewhere?)
>

When rendering the form.  You are using the client as a store.



> Where in the code sample do we pick up after successful
> authentication in order to (forward, detach, redirect - pick one or supply
> alt.)?
>

You don't.  if the original post was to /user (e.g. to create a new user)
then the "login" form looks just like your normal login form, but the action
is a POST to /user.



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100804/e9b39=
13d/attachment.htm


More information about the Catalyst mailing list