1 dump('entering auth/session.js\n');
3 if (typeof auth == 'undefined') auth = {};
4 auth.session = function (view) {
6 JSAN.use('util.error'); this.error = new util.error();
7 JSAN.use('main.network'); this.network = new main.network();
13 auth.session.prototype = {
15 'init' : function () {
18 var init = this.network.request(
20 'open-ils.auth.authenticate.init',
21 [ this.view.name_prompt.value ]
26 var robj = this.network.request(
28 'open-ils.auth.authenticate.complete',
30 this.view.name_prompt.value,
34 this.view.password_prompt.value
40 if (robj.ilsevent == 0) {
41 this.key = robj.authtoken;
43 var error = robj.ilsevent + ' : ' + this.error.get_ilsevent( robj.ilsevent );
44 this.error.sdump('D_AUTH','auth.session.init: ' + error + '\n');
49 this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
51 if (typeof this.on_init == 'function') {
52 this.error.sdump('D_AUTH','auth.session.on_init()\n');
58 var error = 'open-ils.auth.authenticate.init returned false\n';
59 this.error.sdump('D_ERROR',error);
64 var error = 'Error on auth.session.init(): ' + js2JSON(E) + '\n';
65 this.error.sdump('D_ERROR',error);
67 if (typeof this.on_init_error == 'function') {
68 this.error.sdump('D_AUTH','auth.session.on_init_error()\n');
69 this.on_init_error(E);
71 if (typeof this.on_error == 'function') {
72 this.error.sdump('D_AUTH','auth.session.on_error()\n');
77 /* This was for testing
78 if (typeof this.on_init == 'function') {
79 this.error.sdump('D_AUTH','auth.session.on_init() despite error\n');
86 'close' : function () {
87 this.error.sdump('D_AUTH','auth.session.close()\n');
89 if (typeof this.on_close == 'function') {
90 this.error.sdump('D_AUTH','auth.session.on_close()\n');
97 dump('exiting auth/session.js\n');