From e6a0957260683b5e12d16f7b3e3546ecb11919b1 Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Thu, 2 Jun 2016 17:52:02 -0400 Subject: [PATCH] LP#1528647 Self-check only accepts user name value if regex for barcode not set up This patch was written by Bob Wicksall and posted to launchpad. I've tested on my own server and packaged it for review here. The fix allows a patron to log into the self-check interface with either a barcode or a user name. Signed-off-by: Terran McCanna Revert "LP#1528647 Self-check only accepts user name value if regex" Terran reports this not working as expected. This reverts commit 0eb3a73c2fba4f609c0dab015a843a550e03516e. LP#1528647 Self-check only accepts user name value if regex for barcode not set up This fix allows a patron to log into the self-check interface with either a barcode or a user name. Written by: Bob Wicksall Signed-off-by: Terran McCanna LP#1528647 Self-check only accepts user name value if regex for barcode not set up The original fix only worked if password was not required for self-check. This fix allows it to work when password is required as well. Signed-off-by: Terran McCanna --- Open-ILS/web/js/dojo/openils/User.js | 8 ++++++-- Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/User.js b/Open-ILS/web/js/dojo/openils/User.js index ef17bf8a29..93a1212485 100644 --- a/Open-ILS/web/js/dojo/openils/User.js +++ b/Open-ILS/web/js/dojo/openils/User.js @@ -124,8 +124,12 @@ if(!dojo._hasResource["openils.User"]) { if (!args.passwd) args.passwd = _u.passwd; if (!args.agent) args.agent = _u.login_agent; if (!args.type) args.type = _u.type; - - var initReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.init', args.username); + + if (args.username) { + var initReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.init', args.username); + } else { + var initReq = OpenSRF.CachedClientSession('open-ils.auth').request('open-ils.auth.authenticate.init', args.barcode); + } initReq.oncomplete = function(r) { var seed = r.recv().content(); 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 0b52b92e31..ae748bbe29 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -333,9 +333,9 @@ SelfCheckManager.prototype.loadOrgSettings = function() { } if(settings[SET_BARCODE_REGEX]) { - this.patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value) + this.patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value); } else { - this.patronBarcodeRegex = newRegExp(/^\d/); + this.patronBarcodeRegex = new RegExp(/^\d/); // this assumes barcodes start with digits } -- 2.11.0