make the authcookie param (and openils.User.authcookie) useful
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Sep 2010 21:08:07 +0000 (21:08 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Sep 2010 21:08:07 +0000 (21:08 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17490 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/User.js

index 24d6756..bd91ba8 100644 (file)
@@ -24,6 +24,7 @@ if(!dojo._hasResource["openils.User"]) {
     dojo.require('fieldmapper.Fieldmapper');
     dojo.require('fieldmapper.OrgUtils');
     dojo.require('openils.Util');
+    dojo.require('dojo.cookie');
     dojo.requireLocalization("openils.User", "User");
 
     dojo.declare('openils.User', null, {
@@ -51,6 +52,7 @@ if(!dojo._hasResource["openils.User"]) {
             this.authcookie = kwargs.authcookie || openils.User.authcookie;
             this.permOrgStoreCache = {}; /* permName => permOrgUnitStore map */
 
+            if (this.authcookie) this.authtoken = dojo.cookie(this.authcookie);
             if (this.id && this.authtoken) this.user = this.getById( this.id );
             else if (this.authtoken) this.getBySession();
             else if (kwargs.login) this.login();
@@ -148,7 +150,6 @@ if(!dojo._hasResource["openils.User"]) {
                                        if (!openils.User.authtime) openils.User.authtime = _u.authtime;
                     _u.getBySession(onComplete);
                     if(_u.authcookie) {
-                        dojo.require('dojo.cookie');
                         dojo.cookie(_u.authcookie, _u.authtoken, {path:'/'});
                     }
                 }
@@ -192,7 +193,6 @@ if(!dojo._hasResource["openils.User"]) {
             if (!openils.User.authtime) openils.User.authtime = _u.authtime;
 
             if(_u.authcookie) {
-                dojo.require('dojo.cookie');
                 dojo.cookie(_u.authcookie, _u.authtoken, {path:'/'});
             }