From 5e1b0d6454e0d820d4ca6493638603522813336a Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Mon, 10 Aug 2020 01:28:26 +0000 Subject: [PATCH] Bug 26067 Member email validation based on MX record. To Test Currently we are doing testing for Primary email address from the OPAC page. 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 for ex: amit@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 for ex: amit@gmail.c and click on Submit button and it will give error message "Invalid primary email address". --- ..._26067_PatronEmailValidationMXrecord_add__system_preference.perl | 6 ++++++ installer/data/mysql/sysprefs.sql | 1 + koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 1 + opac/opac-memberentry.pl | 2 ++ 5 files changed, 16 insertions(+) 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..314a9c2 --- /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','Mail Exchange (MX) records are DNS records that are necessary for delivering email to Patron.','YesNo')" ); + + NewVersion( $DBversion, 22660, "Adds PatronEmailValidationMXrecord system preference"); +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 6937558..feefe34 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -492,6 +492,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo'), ('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'), ('PatronSelfRegistrationEmailMustBeUnique', '0', 'If set, the field borrowers.email will be considered as a unique field on self registering', NULL, 'YesNo'), +('PatronEmailValidationMXrecord','1','NULL','Mail Exchange (MX) records are DNS records that are necessary for delivering email to Patron.','YesNo'), ('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'), ('PatronSelfRegistrationLibraryList','',NULL,'Only display libraries listed. If empty, all libraries are displayed.','Free'), ('PatronSelfRegistrationPrefillForm','1',NULL,'Display password and prefill login form after a patron has self registered','YesNo'), 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 6805e6f..d92b6e8 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 @@ -829,6 +829,12 @@ OPAC: syntax: text/html class: html - + - pref: PatronEmailValidationMXrecord + choices: + yes: Require + no: "Dont't require" + - "Mail Exchange (MX) records are DNS records that are necessary for delivering email to Patron." + - - pref: PatronSelfRegistrationEmailMustBeUnique choices: yes: "Consider" 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 7acd45a..066a6d8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -78,6 +78,7 @@