after clearing out a stale ses cookie, return user to originally requested resource...
authorberick <berick@esilibrary.com>
Thu, 7 Apr 2011 18:25:13 +0000 (14:25 -0400)
committerberick <berick@esilibrary.com>
Thu, 7 Apr 2011 18:25:13 +0000 (14:25 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm

index bfdd178..54bada4 100644 (file)
@@ -193,11 +193,10 @@ sub load_common {
 
         } else {
 
-            # For now, keep an eye out for any pages being unceremoniously redirected to logout...
-            $self->apache->log->info("catloader: loading " . $ctx->{path_info} . 
-                "; auth session " .  $e->authtoken . " no longer valid; redirecting to logout");
-
-            return $self->load_logout;
+            # if we encounter a stale authtoken, call load_logout 
+            # to clean up the cookie, then redirect the user to the
+            # originally requested page
+            return $self->load_logout($self->apache->unparsed_uri);
         }
     }
 
@@ -269,13 +268,14 @@ sub load_login {
 # -----------------------------------------------------------------------------
 sub load_logout {
     my $self = shift;
+    my $redirect_to = shift;
 
     # If the user was adding anyting to an anonymous cache 
     # while logged in, go ahead and clear it out.
     $self->clear_anon_cache;
 
     return $self->generic_redirect(
-        $self->ctx->{home_page},
+        $redirect_to || $self->ctx->{home_page},
         $self->cgi->cookie(
             -name => COOKIE_SES,
             -path => '/',