On Fri, Jan 11, 2008 at 07:06:17PM +0000, Jonas Alves wrote:
> On Jan 11, 2008 6:27 PM, Matt S Trout <[EMAIL PROTECTED]> 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/

_______________________________________________
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