[Catalyst] Fwd: [gmane.comp.web.catalyst.general] a question on Catalyst::Plugin::Authenticatin

Fayland Lam fayland at gmail.com
Fri Jun 15 03:57:04 GMT 2007


---------- Forwarded message ----------
From: chylli <lchangying at gmail.com>
Date: Jun 15, 2007 2:50 AM
Subject: [gmane.comp.web.catalyst.general] a question on
Catalyst::Plugin::Authenticatin
To: fayland at gmail.com


--

Thanks & Regards

Chylli


---------- Forwarded message ----------
From: chylli <lchangying at gmail.com>
To:
Date: Fri, 15 Jun 2007 09:41:47 +0800
Subject: a question on Catalyst::Plugin::Authenticatin
hi. I use Catalyst::Plugin::Authentication to authenticate my
users. configure is following:
authentication:
    dbic:
        user_class : Db::Users
        user_field : name
        password_field : password
        password_type : clear

use Catalyst qw/    Session
Session::Store::Memcached
Session::State::Cookie
Authentication
Authentication::Store::DBIC
Authentication::Credential::Password
/;

users can keep there login state permanent. But users can change there
username. When they use two different browser, or use two computer to
login, and change his name on one machine, then the other machine will
report an error because $c->user_exists is true but $c->user is a null
value because catalyst can't find that username in db. user can't
visit any page, even can't logoff.

my way to resolve it is , change configure as following:
authentication:
    dbic:
        user_class : Db::Users
        user_field : user_id
        password_field : password
        password_type : clear

#this usename is got from $c->query
my $user = $c->model('Db::User')->single({name => $username});
if($c->login($user->id, $password){.....}.

But I think changing username is a general action to most of
applications. Maybe there are other way to resolve it ? or maybe can
add an configure variable like 'id_field', then change $c->login
method to use that ?


--

Thanks & Regards

Chylli



-- 
fayland - http://www.fayland.org



More information about the Catalyst mailing list