[Catalyst] Overwriting/restoring request data
Rajesh Mallah
mallah at redgrape.tech
Mon Nov 5 07:41:28 GMT 2018
Hi Carl ,
why not just use sessions which are available
irrespective of user is logged in or not
$c->session i mean.
Regds
Rajesh Kumar Mallah.
Redgrape Technologies ( https://www.redgrape.tech )
Mobile: 09811255597, Land: 011-49044122
----------------------------------------------------------------------------------------------------------
Opportunities are usually disguised as hard work, so most people don't
recognize them
----------------------------------------------------------------------------------------------------------
----- Original Message -----
| From: "fireartist" <catalyst at fireartist.com>
| To: "Catalyst" <catalyst at lists.scsys.co.uk>
| Sent: Monday, November 5, 2018 3:44:23 AM
| Subject: [Catalyst] Overwriting/restoring request data
| Hi,
|
| 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 ) = @_;
|
| $self->require_login($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
| field.
| 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,
| Carl
|
|
| _______________________________________________
| List: Catalyst at 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/
More information about the Catalyst
mailing list