[Catalyst] tutorial - adding "auth" function
Sarah Berry
berry.sarah at gmail.com
Thu Jun 8 17:59:04 CEST 2006
Would that be at
http://dev.catalyst.perl.org/docs/Catalyst/Manual/Tutorial.html ?
On 6/8/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
>
> Sarah Berry wrote:
> > Thanks to everyone! It finally works, and here is the code:
> >
> > sub auto : Private {
> > my ( $self, $c) = @_;
> > #if ($c->request->path =~ m(users/login)) {
> > if ($c->action->reverse eq 'users/login') {
> > return 1;
> > }
> > if ( !$c->user_exists) { # Catalyst::Plugin::Authentication
> > $c->res->redirect( '/users/login' ); # require login
> > $c->res->body("Redirecting to login ... ");
> > return 0; # abort request and go immediately to end()
> > }
> > return 1; # success; carry on to next action
> > }
> >
> > sub end : Private {
> > my ($self, $c) = @_;
> > $c->forward('tutorial::View::TToolkit') unless $c->res->body();
> > }
> >
> > I used Matt's suggestion so that, as Jürgen pointed out, someone
> > couldn't access a page like http://server/users/delete/all /users/login
> .
> >
> > Thank you for the link to the new tutorial docs. I will definitely check
> > those out.
>
> Actually, we just merged 'em back to trunk so look there instead :)
>
> --
> Matt S Trout Offering custom development, consultancy and
> support
> Technical Director contracts for Catalyst, DBIx::Class and BAST.
> Contact
> Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more
> information
>
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060608/8f0fd2dc/attachment-0001.htm
More information about the Catalyst
mailing list