From e4951f7ddd634d94f03a95424231201eee1b988f Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 31 Oct 2005 22:32:28 +0000 Subject: [PATCH] some other tweaks, in the same vein of passing in only as little information as necessary to objects git-svn-id: svn://svn.open-ils.org/ILS/trunk@1928 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../chrome/content/evergreen/auth/controller.js | 3 ++- .../chrome/content/evergreen/auth/session.js | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/controller.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/controller.js index 72ae91b8fc..94009bb0da 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/controller.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/controller.js @@ -17,7 +17,7 @@ auth.controller.prototype = { // This talks to our ILS JSAN.use('auth.session'); - obj.session = new auth.session(obj); + obj.session = new auth.session(obj.view); // Attach this object to the XUL through event listeners @@ -85,6 +85,7 @@ auth.controller.prototype = { this.error.sdump('D_AUTH','auth.controller.session.on_init = ' + 'auth.controller.on_login\n'); this.session.on_init = this.on_login; + this.session.on_error = this.on_logoff; } this.session.init(); diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/session.js b/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/session.js index 8904589058..d383a15ee8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/session.js +++ b/Open-ILS/xul/staff_client/chrome/content/evergreen/auth/session.js @@ -1,11 +1,11 @@ dump('entering auth/session.js\n'); if (typeof auth == 'undefined') auth = {}; -auth.session = function (controller) { +auth.session = function (view) { JSAN.use('util.error'); this.error = new util.error(); JSAN.use('main.network'); this.network = new main.network(); - this.controller = controller; + this.view = view; return this; }; @@ -18,7 +18,7 @@ auth.session.prototype = { var init = this.network.request( 'open-ils.auth', 'open-ils.auth.authenticate.init', - [ this.controller.view.name_prompt.value ] + [ this.view.name_prompt.value ] ); if (init) { @@ -27,11 +27,11 @@ auth.session.prototype = { 'open-ils.auth', 'open-ils.auth.authenticate.complete', [ - this.controller.view.name_prompt.value, + this.view.name_prompt.value, hex_md5( init + hex_md5( - this.controller.view.password_prompt.value + this.view.password_prompt.value ) ) ] @@ -54,7 +54,10 @@ auth.session.prototype = { var error = 'open-ils.auth.authenticate.init returned false\n'; this.error.sdump('D_ERROR',error); - this.controller.logoff(); + if (typeof this.on_error == 'function') { + this.error.sdump('D_AUTH','auth.session.on_error()\n'); + this.on_error(); + } throw(error); } -- 2.43.2