JBAS-1638 Patron self-reg cleans spaces
authorBill Erickson <berickxx@gmail.com>
Tue, 18 Oct 2016 19:34:34 +0000 (15:34 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Remove leading / trailing spaces from user-entered values in patron
self-registration app.  In addition to resulting in cleaner data, it
allows the patron editor's duplicate patron search code to work w/ like
values.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Register.pm

index ff6c983..6bdd3d0 100644 (file)
@@ -477,6 +477,9 @@ sub inspect_register_value {
     my %keep_case = (usrname => 1, passwd => 1, email => 1);
     $value = uc($value) unless $keep_case{$field};
 
+    # JBAS-1638 remove opening/trailing spaces
+    $value =~ s/(^\s*|\s*$)//g;
+
     my $regex = $self->{register}{settings}{$scls}{$field}{regex};
     return $value if !$regex or $value =~ /$regex/; # field is valid