[Catalyst] Problem with authentication

Tomas Doran bobtfish at bobtfish.net
Wed Apr 22 12:54:02 GMT 2009


Renee Bäcker wrote:
> [info] *** Request 1 (0.167/s) [10155] [Wed Apr 22 12:56:43 2009] ***
> [debug] Body Parameters are:
> .-------------------------------------+--------------------------------------.
> | Parameter                           | Value
>     |
> +-------------------------------------+--------------------------------------+
> | password                            | secret
>     |
> | username                            | reneeb
>     |
> '-------------------------------------+--------------------------------------'
> [debug] "POST" request for "root/login" from "127.0.0.1"
> [debug] Path is "root/login"
> [debug] login successful:
> [debug] Finding template to render ...
> [debug] Trying to render template
> "/dir/templates/start.tmpl" ...
> [debug] Redirecting to "http://localhost:3000/root/start"
> [info] Request took 0.167890s (5.956/s)
> .------------------------------------------------------------+-----------.
> | Action                                                     | Time
> |
> +------------------------------------------------------------+-----------+
> | /root/login                                                | 0.114807s
> |
> | /end                                                       | 0.036004s
> |
> |  -> GriPS::View::TT->process                               | 0.033808s
> |
> '------------------------------------------------------------+-----------'

Erm, something wacky is going on here - how come you're rendering a 
template if this is a redirect?

Are you using RenderView, and can you show us your end action?

> 
> [info] *** Request 2 (0.333/s) [10155] [Wed Apr 22 12:56:43 2009] ***
> [debug] "GET" request for "root/start" from "127.0.0.1"
> [debug] Path is "root/start"
> [debug] Finding template to render ...
> [debug] Trying to render template
> "/dir/templates/start.tmpl" ...
> [error] Caught exception in GriPS::Controller::Root->start "Can't call
> method "user_id" on an undefined value at
> /dir/../lib/GriPS/Controller/Root.pm
> line 52."

I would guess this is due to the fact that your template processing 
blows up, and the hit is aborted at that point, but the current response 
is still sent (and as it has a 302 code, the response body is ignored, 
and you are redirected).

Although I may be totally wrong about the specifics, however isn't 
anything in the log here to make out that the user data is being 
serialized into your session at the end of the hit, or restored at the 
beginning of the next hit, which is your issue..

(Also, you need to check that $c->user returns something before calling 
methods on the user otherwise someone directly accessing /start without 
logging in first will get a 500 page)

Cheers
t0m



More information about the Catalyst mailing list