some other tweaks, in the same vein of passing in only as little information as neces...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 31 Oct 2005 22:32:28 +0000 (22:32 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 31 Oct 2005 22:32:28 +0000 (22:32 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1928 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/auth/controller.js
Open-ILS/xul/staff_client/chrome/content/evergreen/auth/session.js

index 72ae91b..94009bb 100644 (file)
@@ -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();
index 8904589..d383a15 100644 (file)
@@ -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);
                        }