handle the WORKSTATION_NOT_FOUND event for old registrations
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jun 2006 04:20:17 +0000 (04:20 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jun 2006 04:20:17 +0000 (04:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4776 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 0607397..dd6e462 100644 (file)
@@ -48,14 +48,31 @@ auth.session.prototype = {
                                        [ params ]
                                );
 
-                               if (robj.ilsevent == 0) {
-                                       this.key = robj.payload.authtoken;
-                                       this.authtime = robj.payload.authtime;
-                               } else {
-                                       var error = robj.ilsevent + ' : ' + this.error.get_ilsevent( robj.ilsevent );
-                                       this.error.sdump('D_AUTH','auth.session.init: ' + error + '\n');
-                                       alert( error );
+                               switch (robj.ilsevent) {
+                                       case 0:
+                                               this.key = robj.payload.authtoken;
+                                               this.authtime = robj.payload.authtime;
+                                       break;
+                                       case 1520 /* WORKSTATION_NOT_FOUND */:
+                                               alert(params.workstation + ' is not registered with this server.');
+                                               delete(params.workstation);
+                                               delete(data.ws_info[ this.view.server_prompt.value ]);
+                                               data.stash('ws_info');
+                                               data.ws_name = null; data.stash('ws_name');
+                                               params.type = 'temp';
+                                               robj = this.network.simple_request('AUTH_COMPLETE',[ params ]);
+                                               if (robj.ilsevent == 0) {
+                                                       this.key = robj.payload.authtoken;
+                                                       this.authtime = robj.payload.authtime;
+                                               } else {
+                                                       this.error.standard_unexpected_error_alert('auth.session.init',robj);
+                                                       throw(robj);
+                                               }
+                                       break;
+                                       default:
+                                       this.error.standard_unexpected_error_alert('auth.session.init',robj);
                                        throw(robj);
+                                       break;
                                }
 
                                this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');