[Catalyst] backward compatibility problem with new
C::P::Authentication (for info only)
Daniel McBrearty
danielmcbrearty at gmail.com
Thu Dec 13 20:26:36 GMT 2007
Hi,
I don't consider this a bug, it's just by way of feedback to the list
and module authors.
I just updated to the latest C::P::Authentication and now get errors
in my login code in some places. My code looks basically like this
(simplified a bit) :
sub login Chained('/') Args(0) : {
# first check that username and password are supplied
if ( $c->login) {
my $user = $c->get_user( $username );
$user->last_login( DateTime->now );
# ... etc
}
}
What seems to happen under some circumstances (haven't quite figured
out why this happens sometimes and not others, yet) is this:
[debug] Restored session "8d0c0673cde8a3ed970944917a9d77d5"
[debug] Successfully authenticated user ''.
[error] Caught exception in Engoi::Controller::Member->login "Can't
call method "last_login" on an undefined value at
/home/daniel/work/engoi/trunk/Engoi/script/../lib/Engoi/Controller/Member.pm
line 48."
This is a bit odd, as a username *is* supplied (note the empty
username which seems to have been authenticated in the debug output).
My config looks like this:
authentication:
dbic:
user_class: 'Schema::Members'
user_field: 'username'
password_field: 'password'
password_type: 'crypted'
I figure the best is to update to a setup with a default realm, which
looks like it shouldn't be too hard, I hope, and use the authenticate
method. As I did not check compatibility when the module was announced
(I know, I know, sorry, mea culpa, ideal time of year to cut me off
the Christmas card list ... ), I have no problem with this :-)
cheers
Daniel
More information about the Catalyst
mailing list