--- lib/Catalyst/Authentication/Store/DBIx/Class/User.pm.orig	2008-02-15 07:48:15.000000000 +0100
+++ lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2008-08-19 14:24:07.000000000 +0200
@@ -73,7 +73,13 @@
         ## merge the ignore fields array into a hash - so we can do an easy check while building the query
         my %ignorefields = map { $_ => 1} @{$self->config->{'ignore_fields_in_find'}};                                    
         my $searchargs = {};
-        
+
+        # Replace username with id_field in authinfo
+        if ( my $id_field = $self->config->{'id_field'} ) {
+            $authinfo->{$id_field} = $authinfo->{'username'};
+            delete($authinfo->{'username'});
+        }
+
         # now we walk all the fields passed in, and build up a search hash.
         foreach my $key (grep {!$ignorefields{$_}} keys %{$authinfo}) {
             if ($self->resultset->result_source->has_column($key)) {
