[Catalyst-commits] r8145 - in trunk/Catalyst-Authentication-Store-DBIx-Class: . lib/Catalyst/Authentication/Store/DBIx/Class

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Mon Jul 21 23:28:31 BST 2008


Author: jayk
Date: 2008-07-21 23:28:31 +0100 (Mon, 21 Jul 2008)
New Revision: 8145

Modified:
   trunk/Catalyst-Authentication-Store-DBIx-Class/Changes
   trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
Log:
Be more descriptive about failure when no valid fields were defined in
the authinfo hash (passed to $c->authenticate() )

allow any whitespace to separate roles in the roles column



Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/Changes
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/Changes	2008-07-21 14:09:49 UTC (rev 8144)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/Changes	2008-07-21 22:28:31 UTC (rev 8145)
@@ -1,5 +1,11 @@
 Revision history for Catalyst-Plugin-Authentication-Store-DBIx-Class
 
+0.105   2008-03-19
+        Throw an exception if no fields are provided during authenticate
+           - better than retrieving a random user. 
+           - still possible to do an empty search by using searchargs
+        
+
 0.104   2008-02-15
         Added ability to avoid DB hits when restoring from session
 

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2008-07-21 14:09:49 UTC (rev 8144)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2008-07-21 22:28:31 UTC (rev 8145)
@@ -83,7 +83,11 @@
                 $searchargs->{$key} = $authinfo->{$key};
             }
         }
-        $self->_user($self->resultset->search($searchargs)->first);
+        if (keys %{$searchargs}) {
+            $self->_user($self->resultset->search($searchargs)->first);
+        } else {
+            Catalyst::Exeption->throw("User retrieval failed: no columns from " . $self->config->{'user_class'} . " were provided");
+        }
     }
 
     if ($self->get_object) {
@@ -118,7 +122,7 @@
     if (exists($self->config->{'role_column'})) {
         my $role_data = $self->get($self->config->{'role_column'});
         if ($role_data) { 
-            @roles = split /[ ,\|]+/, $self->get($self->config->{'role_column'});
+            @roles = split /[\s,\|]+/, $self->get($self->config->{'role_column'});
         }
         $self->_roles(\@roles);
     } elsif (exists($self->config->{'role_relation'})) {




More information about the Catalyst-commits mailing list