Bugzilla – Attachment 107975 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), 5.12 KB, created by
Amit Gupta
on 2020-08-09 16:20:09 UTC
(
hide
)
Description:
Bug 26067 Member email validation based on MX record.
Filename:
MIME Type:
Creator:
Amit Gupta
Created:
2020-08-09 16:20:09 UTC
Size:
5.12 KB
patch
obsolete
>From 4beae3b11f9009a04f3469cef530a90ad7acb7df Mon Sep 17 00:00:00 2001 >From: Amit Gupta <amit.gupta@informaticsglobal.com> >Date: Sun, 9 Aug 2020 16:12:28 +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@gmail12.com you will able to submit the page and it will not give any error message. >6. Apply the patch. >7. Enable system preference PatronEmailValidationMXrecord set as 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@gmail12.com and click on Submit button and it will give error message "Invalid primary email address". >--- > ...26067_PatronEmailValidationMXrecord_add__system_preference.perl | 7 +++++++ > .../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 ++ > 4 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..3354957 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl >@@ -0,0 +1,7 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronEmailValidationMXrecord','0','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/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..33e69e6 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 >@@ -790,6 +790,12 @@ OPAC: > - "library patrons to register for an account via the OPAC." > - "<br><strong>NOTE:</strong> This needs PatronSelfRegistrationDefaultCategory to be set to a valid patron category code." > - >+ - 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: PatronSelfRegistrationVerifyByEmail > choices: > yes: Require >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..8e08035 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