From fd7c346dd72034d1066be5c5ffea0e97ebc50893 Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Sat, 22 Aug 2020 15:38:20 +0000 Subject: [PATCH] Bug 26067: Member email validation based on MX record. To Test 1. Enable system preference PatronSelfRegistration 2. Set PatronSelfRegistrationDefaultCategory for ex: ST 3. Set PatronSelfRegistrationLibraryList for ex: MPL 4. Open the page /cgi-bin/koha/opac-memberentry.pl 5. Fill the form and enter email address in Primary email, Secondary email and B_email for ex: amit@gmail.c, amit1@gmail.c, amitgupta@gmail.c you will able to submit the page and it will not give any error message. 6. Apply the patch 7. Check system preference PatronEmailValidationMXrecord by default it show "Require". 8. Open the /cgi-bin/koha/opac-memberentry.pl again 9. Fill the form and enter email address in Primary email, Secondary email and B_email for ex: amit@gmail.c, amit1@gmail.c, amitgupta@gmail.c and click on Submit button and it will give error message "Invalid primary email address", "Invalid secondary email address", "Invalid email address". 10. This patch will check email, emailpro and B_email address field. --- ...tronEmailValidationMXrecord_add__system_preference.perl | 6 ++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ .../opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 3 +++ opac/opac-memberentry.pl | 14 ++++++++++++-- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl diff --git a/installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl b/installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl new file mode 100644 index 0000000..df0cc90 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl @@ -0,0 +1,6 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronEmailValidationMXrecord','1','NULL','email address entered on patron self registration to pass Mail Exchange (MX) record check.','YesNo')" ); + + NewVersion( $DBversion, 26067, "Adds PatronEmailValidationMXrecord system preference"); +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 09564db..20f04cb 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -484,6 +484,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'), ('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'), ('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'), +('PatronEmailValidationMXrecord','1','NULL','email address entered on patron self registration to pass Mail Exchange (MX) record check.','YesNo'), ('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'), ('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'), ('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index a9b9ff8..dcfd6e8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -783,6 +783,12 @@ OPAC: Self registration and modification: - + - pref: PatronEmailValidationMXrecord + choices: + yes: Require + no: "Don't require" + - "email address entered on patron self registration to pass Mail Exchange (MX) record check." + - - pref: PatronSelfRegistration choices: yes: Allow diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index 0bf6bd1..08c4edc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -78,8 +78,11 @@