From 528484d0f824e7abb5edc3edd2cd8bfd9dcf93e2 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 22 Mar 2021 14:49:47 -0300 Subject: [PATCH] Bug 28017: (follow-up) Make controller scripts use -fqdn as well This patch makes the *memberentry.pl scripts use the -fqdn flag as well. This is to allow setting the @localhost addresses. I'm not sure about the need for this patch, as we shouldn't probably allow end-users to use such addresses, and for testing purposes we can set things on the DB. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- members/memberentry.pl | 6 +++--- opac/opac-memberentry.pl | 6 +++--- opac/opac-shareshelf.pl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index e6be7854a0..88ec9bb906 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -397,13 +397,13 @@ if ($op eq 'save' || $op eq 'insert'){ my $emailalt = $input->param('B_email'); if ($emailprimary) { - push (@errors, "ERROR_bad_email") if (!Email::Valid->address($emailprimary)); + push (@errors, "ERROR_bad_email") if (!Email::Valid->address(-address => $emailprimary, -fqdn => 0)); } if ($emailsecondary) { - push (@errors, "ERROR_bad_email_secondary") if (!Email::Valid->address($emailsecondary)); + push (@errors, "ERROR_bad_email_secondary") if (!Email::Valid->address(-address => $emailsecondary, fqdn => 0)); } if ($emailalt) { - push (@errors, "ERROR_bad_email_alternative") if (!Email::Valid->address($emailalt)); + push (@errors, "ERROR_bad_email_alternative") if (!Email::Valid->address(-address => $emailalt, fqdn => 0)); } if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index dbfd6f83dd..a38a0dbe4a 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -440,7 +440,7 @@ sub CheckForInvalidFields { my $borrower = shift; my @invalidFields; if ($borrower->{'email'}) { - unless ( Email::Valid->address($borrower->{'email'}) ) { + unless ( Email::Valid->address(-address => $borrower->{'email'}, fqdn => 0) ) { push(@invalidFields, "email"); } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited? @@ -466,10 +466,10 @@ sub CheckForInvalidFields { delete $borrower->{'repeat_email'}; } if ($borrower->{'emailpro'}) { - push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'})); + push(@invalidFields, "emailpro") if (!Email::Valid->address(-address => $borrower->{'emailpro'}, fqdn => 0)); } if ($borrower->{'B_email'}) { - push(@invalidFields, "B_email") if (!Email::Valid->address($borrower->{'B_email'})); + push(@invalidFields, "B_email") if (!Email::Valid->address(-address => $borrower->{'B_email'}, fqdn => 0)); } if ( defined $borrower->{'password'} and $borrower->{'password'} ne $borrower->{'password2'} ) diff --git a/opac/opac-shareshelf.pl b/opac/opac-shareshelf.pl index 7eecf6c45f..2674d644c3 100755 --- a/opac/opac-shareshelf.pl +++ b/opac/opac-shareshelf.pl @@ -300,7 +300,7 @@ sub load_template_vars { sub IsEmailAddress { #TODO candidate for a module? - return Email::Valid->address( $_[0] ) ? 1 : 0; + return Email::Valid->address( -address => $_[0], -fqdn => 0 ) ? 1 : 0; } sub randomlist { -- 2.20.1