[Catalyst] tutorial - adding "auth" function

Sarah Berry berry.sarah at gmail.com
Wed Jun 7 23:21:55 CEST 2006


Right, I thought that the line
   if ( !$c->user_exists) {
was a call to Catalyst::Plugin::Authentication to do just that.

On 6/7/06, Wade.Stuart at fallon.com <Wade.Stuart at fallon.com> wrote:

> catalyst-bounces at lists.rawmode.org wrote on 06/07/2006 04:01:56 PM:
>
> > Hi,
> >
> > I've been trying to learn Catalyst by going through the tutorial.
> > I'm stuck on the "exercise for the reader" in which I'm supposed to
> > add an "auto" action in tutorial.pm, to force the user to log in
> > before s/he can view any other pages. I searched the list archives,
> > and someone else with a similar problem was told,
> > "Your auto action redirects *every* access to /users/login, which
> > includes calls of /users/login. So a check for action or path should do
> > the trick."
>
> maybe check to see if the user is logged in before redirecting wholesale
> to
> /users/login?
>
> >
> >     sub auto : Private {
> >         my ( $self, $c) = @_;
> >         if ( !$c->user_exists) {
> >             $c->res->redirect( '/users/login' ); # require login
> >             $c->res->body("redirecting to login ... ");
> >             return 0; # abort request and go immediately to end()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060607/0087cf82/attachment.htm 


More information about the Catalyst mailing list