[open-ils-commits] [GIT] Evergreen ILS branch master updated. 581860cc0df2662f643bed90d099854a34f816cd
Evergreen Git
git at git.evergreen-ils.org
Tue Aug 9 13:34:38 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via 581860cc0df2662f643bed90d099854a34f816cd (commit)
from f3f86aba83c2179569413d6f50a2b132f0371a72 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 581860cc0df2662f643bed90d099854a34f816cd
Author: Jason Etheridge <jason at esilibrary.com>
Date: Mon Aug 8 15:22:34 2011 -0400
username login for web selfcheck
Changes the behavior for the patron-login component (after staff login) to match
the OPAC. By default, it assumes you are logging in with a usrname, but if the
org unit setting 'opac.barcode_regex' is enabled and the incoming value matches,
then it gets treated as a library card barcode instead. If usrname is used, then
the card referenced by actor.usr.card is checked in lieu of a specified barcode.
Signed-off-by: Jason Etheridge <jason at esilibrary.com>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
index bc4bb97..882c980 100644
--- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
+++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
@@ -277,26 +277,26 @@ SelfCheckManager.prototype.loadOrgSettings = function() {
SelfCheckManager.prototype.drawLoginPage = function() {
var self = this;
- var bcHandler = function(barcode) {
- // handle patron barcode entry
+ var bcHandler = function(barcode_or_usrname) {
+ // handle patron barcode/usrname entry
if(self.orgSettings[SET_PATRON_PASSWORD_REQUIRED]) {
// password is required. wire up the scan box to read it
self.updateScanBox({
msg : 'Please enter your password', // TODO i18n
- handler : function(pw) { self.loginPatron(barcode, pw); },
+ handler : function(pw) { self.loginPatron(barcode_or_usrname, pw); },
password : true
});
} else {
// password is not required, go ahead and login
- self.loginPatron(barcode);
+ self.loginPatron(barcode_or_usrname);
}
};
this.updateScanBox({
- msg : 'Please log in with your library barcode.', // TODO
+ msg : 'Please log in with your username or library barcode.', // TODO
handler : bcHandler
});
}
@@ -304,10 +304,21 @@ SelfCheckManager.prototype.drawLoginPage = function() {
/**
* Login the patron.
*/
-SelfCheckManager.prototype.loginPatron = function(barcode, passwd) {
+SelfCheckManager.prototype.loginPatron = function(barcode_or_usrname, passwd) {
this.setupStaffLogin(true); // verify still valid
+ var barcode = null;
+ var usrname = null;
+ console.log('testing ' + barcode_or_usrname);
+ if (barcode_or_usrname.match(this.patronBarcodeRegex)) {
+ console.log('barcode');
+ barcode = barcode_or_usrname;
+ } else {
+ console.log('usrname');
+ usrname = barcode_or_usrname;
+ }
+
if(this.orgSettings[SET_PATRON_PASSWORD_REQUIRED]) {
if(!passwd) {
@@ -320,13 +331,13 @@ SelfCheckManager.prototype.loginPatron = function(barcode, passwd) {
var res = fieldmapper.standardRequest(
['open-ils.actor', 'open-ils.actor.verify_user_password'],
- {params : [this.authtoken, barcode, null, hex_md5(passwd)]}
+ {params : [this.authtoken, barcode, usrname, hex_md5(passwd)]}
);
if(res == 0) {
// user-not-found results in login failure
this.handleAlert(
- dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode]),
+ dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode_or_usrname]),
false, 'login-failure'
);
this.drawLoginPage();
@@ -334,10 +345,15 @@ SelfCheckManager.prototype.loginPatron = function(barcode, passwd) {
}
}
- // retrieve the fleshed user by barcode
+ var patron_id = fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.user.retrieve_id_by_barcode_or_username'],
+ {params : [this.authtoken, barcode, usrname]}
+ );
+
+ // retrieve the fleshed user by id
this.patron = fieldmapper.standardRequest(
- ['open-ils.actor', 'open-ils.actor.user.fleshed.retrieve_by_barcode'],
- {params : [this.authtoken, barcode]}
+ ['open-ils.actor', 'open-ils.actor.user.fleshed.retrieve.authoritative'],
+ {params : [this.authtoken, patron_id]}
);
var evt = openils.Event.parse(this.patron);
@@ -345,14 +361,19 @@ SelfCheckManager.prototype.loginPatron = function(barcode, passwd) {
// verify validity of the card used to log in
var inactiveCard = false;
if(!evt) {
- var card = this.patron.cards().filter(
- function(c) { return (c.barcode() == barcode); })[0];
+ var card;
+ if (barcode) {
+ card = this.patron.cards().filter(
+ function(c) { return (c.barcode() == barcode); })[0];
+ } else {
+ card = this.patron.card();
+ }
inactiveCard = !openils.Util.isTrue(card.active());
}
if(evt || inactiveCard) {
this.handleAlert(
- dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode]),
+ dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode_or_usrname]),
false, 'login-failure'
);
this.drawLoginPage();
-----------------------------------------------------------------------
Summary of changes:
.../web/js/ui/default/circ/selfcheck/selfcheck.js | 49 ++++++++++++++------
1 files changed, 35 insertions(+), 14 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list