From 34a1663c52a3378e84406c1252b1f686d96c90d2 Mon Sep 17 00:00:00 2001 From: phasefx Date: Wed, 29 Sep 2010 20:49:05 +0000 Subject: [PATCH] Fix overzealous prompting for auth credentials, and some debug lines git-svn-id: svn://svn.open-ils.org/ILS/trunk@18106 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/XUL.js | 8 +++++--- Open-ILS/web/js/ui/base.js | 6 ++++++ Open-ILS/web/opac/common/js/opac_utils.js | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/XUL.js b/Open-ILS/web/js/dojo/openils/XUL.js index 692097ee23..00dfdc52bd 100644 --- a/Open-ILS/web/js/dojo/openils/XUL.js +++ b/Open-ILS/web/js/dojo/openils/XUL.js @@ -16,15 +16,17 @@ if(!dojo._hasResource["openils.XUL"]) { if(openils.XUL.isXUL()) { try { if(openils.XUL.enableXPConnect()) { - var CacheClass = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); - return new CacheClass().wrappedJSObject.OpenILS.prototype.data; + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var CacheClass = new Components.Constructor("@mozilla.org/openils_data_cache;1", "nsIOpenILS"); + return new CacheClass().wrappedJSObject.OpenILS.prototype.data; } } catch(e) { console.log("Error loading XUL stash: " + e); + return { 'error' : e }; } } - return {}; + return { 'error' : 'openils.XUL.isXUL() == false' }; } openils.XUL.newTab = function(path, tabInfo, options) { diff --git a/Open-ILS/web/js/ui/base.js b/Open-ILS/web/js/ui/base.js index b49b1e3978..75cafe79b9 100644 --- a/Open-ILS/web/js/ui/base.js +++ b/Open-ILS/web/js/ui/base.js @@ -19,6 +19,11 @@ function oilsSetupUser() { openils.User.authtoken = null; openils.User.workstation = null; + if(!authtoken && openils.XUL.isXUL()) { + stash = openils.XUL.getStash(); + authtoken = stash.session.key + } + if(authtoken) { user = new openils.User(); delete user.sessionCache[authtoken]; @@ -38,6 +43,7 @@ function oilsSetupUser() { dojo.addOnLoad(function(){ if(openils.XUL.isXUL()) { // let XUL handle the login dialog + dump('getNewSession in base.js\n'); openils.XUL.getNewSession( function() { location.href = location.href } ); } else { // in web-only mode, use the dojo login dialog diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 038983e553..9ed6260c9d 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -536,6 +536,7 @@ function setSessionCookie(ses) { if ses != G.user.session, we also force a grab */ function grabUser(ses, force) { + _debug("grabUser auth token = " + ses); if(!ses && isXUL()) { stash = fetchXULStash(); ses = stash.session.key @@ -545,6 +546,7 @@ function grabUser(ses, force) { if(!ses) { ses = cookieManager.read(COOKIE_SES); /* https cookies don't show up in http servers.. */ + _debug("cookie auth token = " + ses); } if(!ses) return false; @@ -563,6 +565,7 @@ function grabUser(ses, force) { if(isXUL()) { dojo.require('openils.XUL'); + dump('getNewSession in opac_utils.js\n'); openils.XUL.getNewSession( function(success, authtoken) { if(success) { -- 2.11.0