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 this.key = this.network.request(
28 'open-ils.auth.authenticate.complete',
30 this.view.name_prompt.value,
34 this.view.password_prompt.value
40 this.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
42 if (Number(this.key) == 0) {
43 throw('Invalid name/password combination.');
44 } else if (instanceOf(this.key,ex)) {
45 throw(this.key.err_msg());
48 if (typeof this.on_init == 'function') {
49 this.error.sdump('D_AUTH','auth.session.on_init()\n');
55 var error = 'open-ils.auth.authenticate.init returned false\n';
56 this.error.sdump('D_ERROR',error);
57 if (typeof this.on_error == 'function') {
58 this.error.sdump('D_AUTH','auth.session.on_error()\n');
65 var error = 'Error on auth.session.init(): ' + E + '\n';
66 this.error.sdump('D_ERROR',error);
68 if (typeof this.on_init_error == 'function') {
69 this.error.sdump('D_AUTH','auth.session.on_init_error()\n');
70 this.on_init_error(E);
74 /* This was for testing
75 if (typeof this.on_init == 'function') {
76 this.error.sdump('D_AUTH','auth.session.on_init() despite error\n');
84 'close' : function () {
85 this.error.sdump('D_AUTH','auth.session.close()\n');
87 if (typeof this.on_close == 'function') {
88 this.error.sdump('D_AUTH','auth.session.on_close()\n');
95 dump('exiting auth/session.js\n');