[Catalyst] process a restored request
Matt S Trout
dbix-class at trout.me.uk
Mon Jan 14 00:55:40 GMT 2008
On Fri, Jan 11, 2008 at 07:06:17PM +0000, Jonas Alves wrote:
> On Jan 11, 2008 6:27 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> > Don't try and serialize $c->req, 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. This is how I handle "user needs to log in to continue" across the
> > board and it makes life much simpler.
> >
> > i.e. something like
> >
> > sub auto :Private {
> > my ($self, $c) = @_;
> > unless ($c->user_exists) {
> > unless ($c->forward('try_login')) {
> > $c->detach('show_login_form');
> > return 0;
> > }
> > }
> > return 1;
> > }
> >
> > sub try_login :Private {
> > my ($self, $c) = @_;
> > my $b = $c->req->body_parameters;
> > return 0 unless $b->{__username};
> > return $c->authenticate({
> > username => $b->{__username}
> > password => $b->{__password}
> > });
> > }
> >
>
> And how do you handle file uploads? Do you save them in the session?
Just keep the file in a temp dir on disk that gets cleaned out regularly
and drop an identifier into the form. Most session stores are not a good
place to store arbitrary sized files.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the Catalyst
mailing list