when auth session times out with embedded catalog, launch the xul login dialog (inste...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Apr 2010 16:28:59 +0000 (16:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 2 Apr 2010 16:28:59 +0000 (16:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16105 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/opac_utils.js

index dcec5f3..2e09b66 100644 (file)
@@ -548,9 +548,27 @@ function grabUser(ses, force) {
        request.send(true);
        var user = request.result();
 
-       if(!user) {
-               doLogout();
-               return false; /* unable to grab the session */
+       if(!user || user.textcode == 'NO_SESSION') {
+
+        if(isXUL()) {
+            dojo.require('openils.XUL');
+            openils.XUL.getNewSession( 
+                function(success, authtoken) { 
+                    if(success) {
+                        ses = authtoken;
+                        var request = new Request(FETCH_SESSION, ses, 1);
+                        request.request.alertEvent = false;
+                        request.send(true);
+                        user = request.result();
+                    }
+                }
+            );
+        }
+
+           if(!user || user.textcode == 'NO_SESSION') {
+                   doLogout();
+                   return false; /* unable to grab the session */
+        }
        }
 
        if( !(typeof user == 'object' && user._isfieldmapper) ) {