[Catalyst] Patch for Catalyst::Authentication::Store::DBIx::Class::User

Matt S Trout dbix-class at trout.me.uk
Fri Aug 22 15:49:49 BST 2008


On Fri, Aug 22, 2008 at 12:31:20AM +0300, Bogdan Lucaciu wrote:
> On Thursday 21 August 2008 23:12:40 David Jack Wange Olrik wrote:
> > Wouldn't it be neat to have the username field configurable, just
> > like 'password_field' ?
> 
> 
> You don't need that, read this:
> http://search.cpan.org/perldoc?Catalyst::Authentication::Store::DBIx::Class#Simple_Retrieval
> 
>     if ($c->authenticate({  
>                           username => $c->req->params->{'username'},
>                           password => $c->req->params->{'password'},
>                           status => [ 'registered', 'active', 'loggedin']
>                          })) {
> 
> These name => value pairs are used more or less directly in the DBIx::Class' 
> search() routine, so in most cases, you can use DBIx::Class syntax to retrieve 
> the user according to whatever rules you have.
> 
> Basically you pass whatever hashref you need to $c->authenticate. The 
> password_field is necessary because of the possible changes done by 
> Credential::Password .

I think the point is that it should be possible to rename fields on the
DBIC side without eneding to change your $c->authenticate line.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the Catalyst mailing list