If a user sends a request that requires a login, I'd like to persist
their data until they've successfully logged-in, and continue without
them having to re-enter the original data.

Currently, anywhere that requires a login has the following method:

sub auto : Private {
     my ( $self, $c ) = @_;


     $c->check_any_user_role(qw( editor admin ));

The require_login method in my BaseController.pm returns true if
logged-in, and does detach('/auth/login') if they're not.

The require_login method is an ideal place to grab the Request data,
freeze it with Storable, encrypt_hex it with Crypt::CBC, and stick it in
the stash.
Then, the login action can put that frozen request into a hidden form
I'd also need to store the $c->action->private_path() so I can detach to
the correct place after login.

The part I'm unsure of is how much of the $c->request data to store, and
how to restore it again after a successful login.

Initially I only need to deal with basic post key/value params, however
I do anticipate needing to deal with file uploads in the future.

Has anyone dealt with this scenario already, or have any advice on how
to restore a different Request?

Many thanks,

List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to