[open-ils-commits] r11627 - in branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content: main util

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Dec 19 13:48:20 EST 2008


Author: phasefx
Date: 2008-12-19 13:48:17 -0500 (Fri, 19 Dec 2008)
New Revision: 11627

Modified:
   branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/main.js
   branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/util/network.js
Log:
backporting changeset 11388 for setting a ses cookie for Vandelay and friends

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/main.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/main.js	2008-12-19 17:02:00 UTC (rev 11626)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/main.js	2008-12-19 18:48:17 UTC (rev 11627)
@@ -90,7 +90,19 @@
 			G.data.server = url; G.data.stash('server'); 
 			G.data.session = { 'key' : G.auth.session.key, 'auth' : G.auth.session.authtime }; G.data.stash('session');
 			G.data.stash_retrieve();
+            try {
+                var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+                var cookieUri = ios.newURI("http://" + G.data.server_unadorned, null, null);
+                var cookieUriSSL = ios.newURI("https://" + G.data.server_unadorned, null, null);
+                var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
 
+                cookieSvc.setCookieString(cookieUri, null, "ses="+G.data.session.key, null);
+                cookieSvc.setCookieString(cookieUriSSL, null, "ses="+G.data.session.key, null);
+
+            } catch(E) {
+                alert('Error setting session cookie: ' + E);
+            }
+
 			grant_perms(url);
 
 			var xulG = {

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2008-12-19 17:02:00 UTC (rev 11626)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2008-12-19 18:48:17 UTC (rev 11627)
@@ -488,6 +488,19 @@
 							network.simple_request('AUTH_DELETE', [ obj.data.session.key ] );
 							obj.data.session = obj.data.previous_session;
 							obj.data.stash('session');
+				            try {
+								var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+								var cookieUri = ios.newURI("http://" + obj.data.server_unadorned, null, null);
+								var cookieUriSSL = ios.newURI("https://" + obj.data.server_unadorned, null, null);
+								var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
+
+								cookieSvc.setCookieString(cookieUri, null, "ses="+obj.data.session.key, null);
+								cookieSvc.setCookieString(cookieUriSSL, null, "ses="+obj.data.session.key, null);
+
+            } catch(E) {
+                alert('Error setting session cookie: ' + E);
+            }
+
 							removeCSSClass(document.getElementById('main_tabbox'),'operator_change');
 						} else {
 							if (network.get_new_session(offlineStrings.getString('menu.cmd_chg_session.label'),{'url_prefix':obj.url_prefix})) {

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/util/network.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/util/network.js	2008-12-19 17:02:00 UTC (rev 11626)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/chrome/content/util/network.js	2008-12-19 18:48:17 UTC (rev 11627)
@@ -261,6 +261,18 @@
 			data.session.key = data.temporary_session.key; 
 			data.session.authtime = data.temporary_session.authtime; 
 			data.stash('session');
+            try {
+                var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+                var cookieUri = ios.newURI("http://" + data.server_unadorned, null, null);
+                var cookieUriSSL = ios.newURI("https://" + data.server_unadorned, null, null);
+                var cookieSvc = Components.classes["@mozilla.org/cookieService;1"].getService(Components.interfaces.nsICookieService);
+
+                cookieSvc.setCookieString(cookieUri, null, "ses="+data.session.key, null);
+                cookieSvc.setCookieString(cookieUriSSL, null, "ses="+data.session.key, null);
+
+            } catch(E) {
+                alert('Error setting session cookie: ' + E);
+            }
 			if (! data.list.au ) data.list.au = [];
 			data.list.au[0] = JSON2js( data.temporary_session.usr );
 			data.stash('list');



More information about the open-ils-commits mailing list