[open-ils-commits] r16016 - in trunk/Open-ILS/web: css/theme js/dojo/openils js/ui templates (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 26 16:03:34 EDT 2010
Author: erickson
Date: 2010-03-26 16:03:29 -0400 (Fri, 26 Mar 2010)
New Revision: 16016
Modified:
trunk/Open-ILS/web/css/theme/default.css
trunk/Open-ILS/web/js/dojo/openils/User.js
trunk/Open-ILS/web/js/ui/base.js
trunk/Open-ILS/web/templates/login.tt2
Log:
for sync login, return true/false to indicate login success. show login failures in web login dialog
Modified: trunk/Open-ILS/web/css/theme/default.css
===================================================================
--- trunk/Open-ILS/web/css/theme/default.css 2010-03-26 20:03:28 UTC (rev 16015)
+++ trunk/Open-ILS/web/css/theme/default.css 2010-03-26 20:03:29 UTC (rev 16016)
@@ -56,3 +56,4 @@
border-bottom:1px solid #ACA899;
}
+.oils-notify-text { color: red; font-weight:bold; }
Modified: trunk/Open-ILS/web/js/dojo/openils/User.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/User.js 2010-03-26 20:03:28 UTC (rev 16015)
+++ trunk/Open-ILS/web/js/dojo/openils/User.js 2010-03-26 20:03:29 UTC (rev 16016)
@@ -138,6 +138,10 @@
var authReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.complete', loginInfo);
authReq.oncomplete = function(rr) {
var data = rr.recv().content();
+
+ if(!data || !data.payload)
+ throw new Error("Login Failed: " + js2JSON(data));
+
_u.authtoken = data.payload.authtoken;
if (!openils.User.authtoken) openils.User.authtoken = _u.authtoken;
_u.authtime = data.payload.authtime;
@@ -180,6 +184,8 @@
[loginInfo]
);
+ if(!data || !data.payload) return false;
+
_u.authtoken = data.payload.authtoken;
if (!openils.User.authtoken) openils.User.authtoken = _u.authtoken;
_u.authtime = data.payload.authtime;
@@ -189,6 +195,8 @@
dojo.require('dojo.cookie');
dojo.cookie(_u.authcookie, _u.authtoken, {path:'/'});
}
+
+ return true;
},
Modified: trunk/Open-ILS/web/js/ui/base.js
===================================================================
--- trunk/Open-ILS/web/js/ui/base.js 2010-03-26 20:03:28 UTC (rev 16015)
+++ trunk/Open-ILS/web/js/ui/base.js 2010-03-26 20:03:29 UTC (rev 16016)
@@ -31,6 +31,7 @@
}
function oilsDoLogin() {
+ openils.Util.hide('oils-login-failed');
var cgi = new openils.CGI();
var workstation = cgi.param('ws') || dojo.cookie('ws');
var user = new openils.User();
@@ -41,9 +42,14 @@
};
if(workstation)
args.workstation = workstation;
- user.login(args);
- dojo.cookie('ses', user.authtoken, {path : '/'});
- location.href = location.href;
+
+ if(user.login(args)) {
+ dojo.cookie('ses', user.authtoken, {path : '/'});
+ location.href = location.href;
+ } else {
+ openils.Util.show('oils-login-failed');
+ }
+
return false;
}
Modified: trunk/Open-ILS/web/templates/login.tt2
===================================================================
--- trunk/Open-ILS/web/templates/login.tt2 2010-03-26 20:03:28 UTC (rev 16015)
+++ trunk/Open-ILS/web/templates/login.tt2 2010-03-26 20:03:29 UTC (rev 16016)
@@ -2,6 +2,7 @@
<div style='display:none;' dojoType="dijit.Dialog" jsId='oilsLoginDialog' class='oils-login-dialog'>
<script>dojo.require('dijit.form.TextBox');</script>
<b>Please Login</b>
+ <div class='hidden oils-notify-text' id='oils-login-failed'>Login Failed</div>
<form>
<table>
<tr>
More information about the open-ils-commits
mailing list