Bugzilla – Attachment 107979 Details for
Bug 26067
Member email validation based on MX record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26067 Member email validation based on MX record.
0001-Bug-26067-Member-email-validation-based-on-MX-record.patch (text/plain), 6.61 KB, created by
Amit Gupta
on 2020-08-10 01:34:48 UTC
(
hide
)
Description:
Bug 26067 Member email validation based on MX record.
Filename:
MIME Type:
Creator:
Amit Gupta
Created:
2020-08-10 01:34:48 UTC
Size:
6.61 KB
patch
obsolete
>From 5e1b0d6454e0d820d4ca6493638603522813336a Mon Sep 17 00:00:00 2001 >From: Amit Gupta <amit.gupta@informaticsglobal.com> >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 @@ > <ul> > [% FOREACH field IN invalid_form_fields %] > [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %] >+ [% IF field == "mxrecordemail" %]<li>Contact information: <a href="#borrower_email">Invalid primary email address</a></li>[% END %] > [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %] > [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %] > [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %] >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index a076cd3..eee0759 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -432,6 +432,8 @@ sub CheckForInvalidFields { > if ($borrower->{'email'}) { > unless ( Email::Valid->address($borrower->{'email'}) ) { > push(@invalidFields, "email"); >+ } elsif ( C4::Context->preference("PatronEmailValidationMXrecord") ) { >+ push(@invalidFields, "mxrecordemail") if ( !Email::Valid->address( -address => $borrower->{'email'}, -mxcheck => 1)); > } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { > my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited? > { >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26067
:
107975
|
107978
|
107979
|
108660
|
108932