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

Jason Kuri jayk at ion0.com
Thu Aug 21 06:00:53 BST 2008


Hi David,

Thanks for the patch, but I think you are misunderstanding the use of
id_field.

The id_field config option is only used when saving to / restoring
from the session, it has no relation to what you pass to the $c-
 >authenticate() call.  By default,
Catalyst::Authentication::Store::DBIx::Class uses the primary key of
the user table.  You only need to specify id_field if the primary key
for the table is multi-column.

Your $c->authenticate({ ... } ) call should contain the fields you
want to query on.  So if your username field is 'user' then you want
to call:

$c->authenticate({ user => $c->req->params->{'login'}, ... });

Generally speaking, the parameters you pass in to authenticate when
using the DBIx::Class store are the same field names you would use in
a call to $resultset->search({ ... });

Hope that helps!

Jay

On Aug 19, 2008, at 6:34 AM, David Jack Wange Olrik wrote:

> Hi,
>
> When specifying a 'id_field' in the config file as stated in the
> documentation it is not used instead of 'username' when looking up
> the user.
>
> This means that the select that looks up the user returns a random
> user from the database as it has no where clause.
>
> This patch fixed that issue.
>
> <User.pm.patch>
>
>
> --
> Best regards,
> David Jack Olrik <david at olrik.dk>             http://david.olrik.dk
> GnuPG fingerprint C290 0A4A 0CCC CBA8 2B37 E18D 01D2 F6EF 2E61 9894
> ["The first rule of Perl club is  You do not talk about Perl club"]
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list