[Catalyst-commits] r8146 - trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Mon Jul 21 23:35:17 BST 2008


Author: jayk
Date: 2008-07-21 23:35:16 +0100 (Mon, 21 Jul 2008)
New Revision: 8146

Modified:
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
Log:
Bark loudly if we are told we can restore from session, but we actually fail

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2008-07-21 22:28:31 UTC (rev 8145)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm	2008-07-21 22:35:16 UTC (rev 8146)
@@ -26,7 +26,7 @@
             $self->config->{'use_session'} = 1;
         }
     }
-    print STDERR "use session is " . $self->config->{'use_session'} . "\n";
+
     $app->log->debug("Setting up auth realm $realmname") if $app->debug;
 
     # use the Null store as a default
@@ -172,11 +172,17 @@
     $frozen_user ||= $self->user_is_restorable($c);
     return unless defined($frozen_user);
 
-    $c->_user( my $user = $self->from_session( $c, $frozen_user ) );
+    my $user = $self->from_session( $c, $frozen_user );
     
-    # this sets the realm the user originated in.
-    $user->auth_realm($self->name);
+    if ($user) {
+        $c->_user( $user );
     
+        # this sets the realm the user originated in.
+        $user->auth_realm($self->name);
+    } else {
+		Catalyst::Exception->throw("Store claimed to have a restorable user, but restoration failed.  Did you change the user's id_field?");
+	}
+	 
     return $user;
 }
 




More information about the Catalyst-commits mailing list