From: Yuval Kogman Date: Sun, 27 Nov 2005 15:45:34 +0000 (+0000) Subject: Don't attempt to restore in auth_restore_user unless there is already a session X-Git-Tag: v0.01~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4402d92dd338ad2ffcb98a6f2c235dcde0ee81cb;p=catagits%2FCatalyst-Plugin-Authentication.git Don't attempt to restore in auth_restore_user unless there is already a session --- diff --git a/lib/Catalyst/Plugin/Authentication.pm b/lib/Catalyst/Plugin/Authentication.pm index 7887cad..e34d3a7 100644 --- a/lib/Catalyst/Plugin/Authentication.pm +++ b/lib/Catalyst/Plugin/Authentication.pm @@ -99,6 +99,8 @@ sub prepare { sub auth_restore_user { my ( $c, $frozen_user, $store_name ) = @_; + return unless $c->isa("Catalyst::PLugin::Session") and $c->config->{authentication}{use_session} and $c->sessionid; + $store_name ||= $c->session->{__user_store}; $frozen_user ||= $c->session->{__user}; @@ -155,12 +157,10 @@ sub auth_stores { sub auth_store_names { my $self = shift; - unless ( $self->_auth_store_names ) { + $self->_auth_store_names || do { tie my %hash, 'Tie::RefHash'; $self->_auth_store_names( \%hash ); } - - $self->_auth_store_names; } sub default_auth_store { @@ -204,14 +204,14 @@ L plugin, =over 4 -=item logout - -Delete the currently logged in user from C and the session. - =item user Returns the currently logged user or undef if there is none. +=item logout + +Delete the currently logged in user from C and the session. + =item get_user $uid Delegate C to the default store.