1 dump('entering auth/session.js\n');
3 if (typeof auth == 'undefined') auth = {};
4 auth.session = function (controller,mw,G) {
6 this.mw = mw; this.G = G; this.controller = controller;
11 auth.session.prototype = {
13 'init' : function () {
16 var init = this.G.network.request(
18 'open-ils.auth.authenticate.init',
19 [ this.controller.view.name_prompt.value ]
24 this.key = this.G.network.request(
26 'open-ils.auth.authenticate.complete',
28 this.controller.view.name_prompt.value,
32 this.controller.view.password_prompt.value
38 this.G.error.sdump('D_AUTH','auth.session.key = ' + this.key + '\n');
40 if (Number(this.key) == 0) {
41 throw('Invalid name/password combination.');
42 } else if (instanceOf(this.key,ex)) {
43 throw(this.key.err_msg());
46 if (typeof this.on_init == 'function') {
47 this.G.error.sdump('D_AUTH','auth.session.on_init()\n');
53 var error = 'open-ils.auth.authenticate.init returned false\n';
54 this.G.error.sdump('D_ERROR',error);
55 this.controller.logoff();
60 var error = 'Error on auth.session.init(): ' + E + '\n';
61 this.G.error.sdump('D_ERROR',error);
63 if (typeof this.on_init_error == 'function') {
64 this.G.error.sdump('D_AUTH','auth.session.on_init_error()\n');
65 this.on_init_error(E);
73 'close' : function () {
74 this.G.error.sdump('D_AUTH','auth.session.close()\n');
76 if (typeof this.G.on_close == 'function') {
77 this.G.error.sdump('D_AUTH','auth.session.on_close()\n');
84 dump('exiting auth/session.js\n');