[Catalyst] forgotten logins

Wijnand Wiersma wijnand at nedbsd.nl
Sat Jan 28 13:32:44 CET 2006


Ok, it is driving me crazy.
lib/app/C/Persons.pm contains following login function:
sub login : Local {
        my ($self, $c) = @_;
        if ($c->req->params->{uname} && $c->req->params->{password}) {
                $c->login($c->req->params->{uname}, 
$c->req->params->{password})
                        or $c->stash->{loginfailed} = 'Could not log you 
in.';
        }
        unless ($c->user_exists) {
                $c->stash->{template} = 'profile.tt';
        }
}
This seems to work fine, when I login I see:
[Sat Jan 28 13:25:28 2006] [catalyst] [debug] "POST" request for 
"persons/login" from "217.170.33.176"
[Sat Jan 28 13:25:28 2006] [catalyst] [debug] Path is "persons/login"
[Sat Jan 28 13:25:28 2006] [catalyst] [debug] Restored session 
"42599a64b3257811d6322a2279024fa7ddc95f0e"
[Sat Jan 28 13:25:28 2006] [catalyst] [debug] Successfully authenticated 
user 'Catalyst::Plugin::Authentication::Store::DBIC::User=HASH(0x7d7695c8)'.
[Sat Jan 28 13:25:28 2006] [catalyst] [debug] Rendering template "index"

Ok, that part works great, but now I go back to the index page:
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] 
**********************************
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] * Request 5 (0.161/s) [17112]
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] 
**********************************
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] Found sessionid 
"42599a64b3257811d6322a2279024fa7ddc95f0e" in cookie
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] "GET" request for "" from 
"217.170.33.176"
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] Restored session 
"42599a64b3257811d6322a2279024fa7ddc95f0e"
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] Rendering template "index"
[Sat Jan 28 13:25:36 2006] [catalyst] [debug] Rendering template "index"
[Sat Jan 28 13:25:36 2006] [catalyst] [info] Request took 0.050892s 
(19.649/s)

As you see, the session is the same, but in my template c.user_exists 
returns false.
I tried to do some debugging in app.pm in the auto function. I added 
following line:
$c->log("$c->user->{name} was here") if $c->user_exists;
but somehow that disables logging in. This was a login request:
[Sat Jan 28 13:29:55 2006] [catalyst] [debug] "POST" request for 
"persons/login" from "217.170.33.176"
[Sat Jan 28 13:29:55 2006] [catalyst] [debug] Path is "persons/login"
[Sat Jan 28 13:29:55 2006] [catalyst] [debug] Restored session 
"42599a64b3257811d6322a2279024fa7ddc95f0e"
[Sat Jan 28 13:29:55 2006] [catalyst] [debug] Rendering template "index"
[Sat Jan 28 13:29:55 2006] [catalyst] [info] Request took 0.051912s 
(19.263/s)

So at this point I don't know how to proceed debugging this. I really 
cannot find why my logged in user is not tied to the session.

Wijnand






More information about the Catalyst mailing list