From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Fri, 2 Apr 2010 16:28:59 +0000 (+0000)
Subject: when auth session times out with embedded catalog, launch the xul login dialog (inste... 
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cefe15b467f4265e0a6f4024476ed02a63f3024b;p=evergreen%2Fmasslnc.git

when auth session times out with embedded catalog, launch the xul login dialog (instead of flopping back to the home page)

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16105 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js
index dcec5f3909..2e09b66e3e 100644
--- a/Open-ILS/web/opac/common/js/opac_utils.js
+++ b/Open-ILS/web/opac/common/js/opac_utils.js
@@ -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) ) {