diff --git a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php index a0f671e04f1f83389d27f88b7bf9866e4bfef9f4..2469be811081c1fd0253ce133d39303c02885d6a 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Voyager.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Voyager.php @@ -1156,6 +1156,19 @@ class Voyager extends AbstractBase ? [] : $this->getPurchaseHistoryData($id); } + /** + * Sanitize patron PIN code (remove characters Voyager doesn't handle properly) + * + * @param string $pin PIN code to sanitize + * + * @return string Sanitized PIN code + */ + protected function sanitizePIN($pin) + { + $pin = preg_replace('/[^0-9a-zA-Z#&<>+^`~]+/', '', $pin); + return $pin; + } + /** * Patron Login * @@ -1216,7 +1229,8 @@ class Voyager extends AbstractBase ? mb_strtolower(utf8_encode($row['FALLBACK_LOGIN']), 'UTF-8') : null; - if ((!is_null($primary) && $primary == $compareLogin) + if ((!is_null($primary) && ($primary == $compareLogin + || $primary == $this->sanitizePIN($compareLogin))) || ($fallback_login_field && is_null($primary) && $fallback == $compareLogin) ) { diff --git a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php index aa58c03b72a8073a5ea228f45e1520fa20223050..84806a944ec145557635c8a4c7a75308bf38a73b 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php +++ b/module/VuFind/src/VuFind/ILS/Driver/VoyagerRestful.php @@ -3150,14 +3150,18 @@ EOT; $lastname = htmlspecialchars($patron['lastname'], ENT_COMPAT, 'UTF-8'); $ubId = htmlspecialchars($this->ws_patronHomeUbId, ENT_COMPAT, 'UTF-8'); $oldPIN = trim( - htmlspecialchars($details['oldPassword'], ENT_COMPAT, 'UTF-8') + htmlspecialchars( + $this->sanitizePIN($details['oldPassword']), ENT_COMPAT, 'UTF-8' + ) ); if ($oldPIN === '') { // Voyager requires the PIN code to be set even if it was empty $oldPIN = ' '; } $newPIN = trim( - htmlspecialchars($details['newPassword'], ENT_COMPAT, 'UTF-8') + htmlspecialchars( + $this->sanitizePIN($details['newPassword']), ENT_COMPAT, 'UTF-8' + ) ); $barcode = htmlspecialchars($patron['cat_username'], ENT_COMPAT, 'UTF-8');