View | Details | Raw Unified | Return to bug 26067
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_26067_PatronEmailValidationMXrecord_add__system_preference.perl (+6 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( "INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronEmailValidationMXrecord','1','NULL','email address entered on patron self registration to pass Mail Exchange (MX) record check.','YesNo')" );
4
5
    NewVersion( $DBversion, 26067, "Adds PatronEmailValidationMXrecord system preference");
6
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 484-489 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
484
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
484
('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'),
485
('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
485
('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'),
486
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
486
('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'),
487
('PatronEmailValidationMXrecord','1','NULL','email address entered on patron self registration to pass Mail Exchange (MX) record check.','YesNo'),
487
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
488
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
488
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
489
('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'),
489
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
490
('PatronSelfModificationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when a patron is editing their information via the OPAC.','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+6 lines)
Lines 783-788 OPAC: Link Here
783
783
784
    Self registration and modification:
784
    Self registration and modification:
785
        -
785
        -
786
            - pref: PatronEmailValidationMXrecord
787
              choices:
788
                  yes: Require
789
                  no: "Don't require"
790
            - "email address entered on patron self registration to pass Mail Exchange (MX) record check." 
791
        -
786
            - pref: PatronSelfRegistration
792
            - pref: PatronSelfRegistration
787
              choices:
793
              choices:
788
                  yes: Allow
794
                  yes: Allow
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (+3 lines)
Lines 78-85 Link Here
78
                        <ul>
78
                        <ul>
79
                            [% FOREACH field IN invalid_form_fields %]
79
                            [% FOREACH field IN invalid_form_fields %]
80
                                [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
80
                                [% IF field == "email" %]<li>Contact information: <a href="#borrower_email">primary email address</a></li>[% END %]
81
                                [% IF field == "mxrecord_email" %]<li>Contact information: <a href="#borrower_email">Invalid primary email address</a></li>[% END %]
81
                                [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
82
                                [% IF field == "emailpro" %]<li>Contact information: <a href="#borrower_emailpro">secondary email address</a></li>[% END %]
83
                                [% IF field == "mxrecord_emailpro" %]<li>Contact information: <a href="#borrower_emailpro">Invalid secondary email address</a></li>[% END %]
82
                                [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
84
                                [% IF field == "B_email" %]<li>Alternate address information: <a href="#borrower_B_email">email address</a></li>[% END %]
85
                                [% IF field == "mxrecord_b_email" %]<li>Alternate address information: <a href="#borrower_B_email">Invalid email address</a></li>[% END %]
83
                                [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
86
                                [% IF field == "password_match" %]<li>Passwords do not match! <a href="#password">password</a></li>[% END %]
84
                                [% IF field == "password_too_short" %]
87
                                [% IF field == "password_too_short" %]
85
                                    <li>Password must be at least [% minPasswordLength | html %] characters long.</li>
88
                                    <li>Password must be at least [% minPasswordLength | html %] characters long.</li>
(-)a/opac/opac-memberentry.pl (-3 / +12 lines)
Lines 432-437 sub CheckForInvalidFields { Link Here
432
    if ($borrower->{'email'}) {
432
    if ($borrower->{'email'}) {
433
        unless ( Email::Valid->address($borrower->{'email'}) ) {
433
        unless ( Email::Valid->address($borrower->{'email'}) ) {
434
            push(@invalidFields, "email");
434
            push(@invalidFields, "email");
435
        } elsif ( C4::Context->preference("PatronEmailValidationMXrecord") ) {
436
            push(@invalidFields, "mxrecord_email") if ( !Email::Valid->address( -address => $borrower->{'email'}, -mxcheck => 1));    
435
        } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) {
437
        } elsif ( C4::Context->preference("PatronSelfRegistrationEmailMustBeUnique") ) {
436
            my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited?
438
            my $patrons_with_same_email = Koha::Patrons->search( # FIXME Should be search_limited?
437
                {
439
                {
Lines 456-465 sub CheckForInvalidFields { Link Here
456
        delete $borrower->{'repeat_email'};
458
        delete $borrower->{'repeat_email'};
457
    }
459
    }
458
    if ($borrower->{'emailpro'}) {
460
    if ($borrower->{'emailpro'}) {
459
        push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'}));
461
        if ( C4::Context->preference("PatronEmailValidationMXrecord") ) {
462
            push(@invalidFields, "mxrecord_emailpro") if (!Email::Valid->address( -address => $borrower->{'emailpro'}, -mxcheck => 1)); 
463
        } else {
464
            push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'}));
465
        }
460
    }
466
    }
461
    if ($borrower->{'B_email'}) {
467
    if ($borrower->{'B_email'}) {
462
        push(@invalidFields, "B_email") if (!Email::Valid->address($borrower->{'B_email'}));
468
        if ( C4::Context->preference("PatronEmailValidationMXrecord") ) {
469
            push(@invalidFields, "mxrecord_b_email") if (!Email::Valid->address( -address => $borrower->{'B_email'}, -mxcheck => 1)); 
470
        } else {
471
            push(@invalidFields, "B_email") if (!Email::Valid->address($borrower->{'B_email'}));
472
        }
463
    }
473
    }
464
    if ( defined $borrower->{'password'}
474
    if ( defined $borrower->{'password'}
465
        and $borrower->{'password'} ne $borrower->{'password2'} )
475
        and $borrower->{'password'} ne $borrower->{'password2'} )
466
- 

Return to bug 26067