Lines 34-40
use Koha::Patron::Consent;
Link Here
|
34 |
use Koha::Patron::Modification; |
34 |
use Koha::Patron::Modification; |
35 |
use Koha::Patron::Modifications; |
35 |
use Koha::Patron::Modifications; |
36 |
use C4::Scrubber; |
36 |
use C4::Scrubber; |
37 |
use Email::Valid; |
37 |
use Email::Address; |
38 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
38 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
39 |
use Koha::Libraries; |
39 |
use Koha::Libraries; |
40 |
use Koha::Patron::Attribute::Types; |
40 |
use Koha::Patron::Attribute::Types; |
Lines 439-445
sub CheckForInvalidFields {
Link Here
|
439 |
my $borrower = shift; |
439 |
my $borrower = shift; |
440 |
my @invalidFields; |
440 |
my @invalidFields; |
441 |
if ($borrower->{'email'}) { |
441 |
if ($borrower->{'email'}) { |
442 |
unless ( Email::Valid->address($borrower->{'email'}) ) { |
442 |
unless ( $borrower->{'email'} =~ m/$Email::Address::mailbox/ ) { |
443 |
push(@invalidFields, "email"); |
443 |
push(@invalidFields, "email"); |
444 |
} elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { |
444 |
} elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) { |
445 |
my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited? |
445 |
my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited? |
Lines 465-474
sub CheckForInvalidFields {
Link Here
|
465 |
delete $borrower->{'repeat_email'}; |
465 |
delete $borrower->{'repeat_email'}; |
466 |
} |
466 |
} |
467 |
if ($borrower->{'emailpro'}) { |
467 |
if ($borrower->{'emailpro'}) { |
468 |
push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'})); |
468 |
push(@invalidFields, "emailpro") if ($borrower->{'emailpro'} !~ m/$Email::Address::mailbox/); |
469 |
} |
469 |
} |
470 |
if ($borrower->{'B_email'}) { |
470 |
if ($borrower->{'B_email'}) { |
471 |
push(@invalidFields, "B_email") if (!Email::Valid->address($borrower->{'B_email'})); |
471 |
push(@invalidFields, "B_email") if ($borrower->{'B_email'} !~ m/$Email::Address::mailbox/); |
472 |
} |
472 |
} |
473 |
if ( defined $borrower->{'password'} |
473 |
if ( defined $borrower->{'password'} |
474 |
and $borrower->{'password'} ne $borrower->{'password2'} ) |
474 |
and $borrower->{'password'} ne $borrower->{'password2'} ) |