LP#1528647 Self-check only accepts user name value if regex
authorTerran McCanna <tmccanna@georgialibraries.org>
Thu, 2 Jun 2016 21:52:02 +0000 (17:52 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Sat, 19 Nov 2016 12:41:59 +0000 (07:41 -0500)
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 <tmccanna@georgialibraries.org>
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 <bwicksall@pls-net.org>

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
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 <tmccanna@georgialibraries.org>
Open-ILS/web/js/dojo/openils/User.js
Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js

index ef17bf8..93a1212 100644 (file)
@@ -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(); 
index 0b52b92..ae748bb 100644 (file)
@@ -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
     }