LP1880726: Support eg2 cookie
authorMike Rylander <mrylander@gmail.com>
Fri, 11 Sep 2020 16:21:24 +0000 (12:21 -0400)
committerBill Erickson <berickxx@gmail.com>
Fri, 11 Sep 2020 17:53:17 +0000 (13:53 -0400)
If there is a stale "ses" cookie hanging around when a staff member logs
into the Angular client, it will be sent to the batch MARC edit handler
along with the active "eg.auth.token" cookie.  We should check for and
prefer the latter in this particular code.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm

index ae91b36..5bd561a 100644 (file)
@@ -55,7 +55,10 @@ sub handler {
     my $r = shift;
     my $cgi = new CGI;
 
-    my $authid = $cgi->cookie('ses') || $cgi->param('ses');
+    my $authid = $cgi->cookie('eg.auth.token') || $cgi->cookie('ses') || $cgi->param('ses');
+    if ($authid =~ /^"(.+)"$/) { # came from eg2 login, is json encoded
+        $authid = $1;
+    }
 
     # Avoid sending the HTML to the caller.  Final response will
     # will just be the cache key or HTTP_BAD_REQUEST on error.