Bugzilla – Attachment 103273 Details for
Bug 24913
Add option to require users to enter email address twice during self-registration.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24913: Add PatronSelfRegistrationConfirmEmail syspref
Bug-24913-Add-PatronSelfRegistrationConfirmEmail-s.patch (text/plain), 9.69 KB, created by
ByWater Sandboxes
on 2020-04-20 11:04:04 UTC
(
hide
)
Description:
Bug 24913: Add PatronSelfRegistrationConfirmEmail syspref
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-04-20 11:04:04 UTC
Size:
9.69 KB
patch
obsolete
>From fe4452c9bf65a4f1492323ef1f1cd58c2269a9b6 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 14 Apr 2020 04:51:41 +0000 >Subject: [PATCH] Bug 24913: Add PatronSelfRegistrationConfirmEmail syspref >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: >1) update database, restart memcached/plack >2) Go to Administration -> System preferences -> OPAC tab. Enable the >new PatronSelfRegistrationConfirmEmail system preference. Enable other >required self registration sysprefs. >3) Go to the OPAC home page. (You may need to log out). Click the >'Register' link so you are redirected to the member entry form. >4) Notice the 'Confirm primary email' field after the 'primary email' >field. Put 'a@a.com' in primary email, and 'b@b.com' in the confirm >field. Scroll to the end of the form and Submit. >5) Confirm the form is not successfully submitted, and an error message >is shown to indicate the email addresses do not match. >6) Confirm you cannot cut, copy or paste in either the primary email or >confirm primary email fields. Confirm the right click menu doesn't work >in these fields. > >7) Disable javascript in your browser. >8) Repeat steps 3 and 4. >9) Confirm there is an error message to indicate the email addresses do >not match. > >10) Re-enable javascript. Fill in the form correctly with matching email >addresses and confirm it successfully submits. > >11) Disable the PatronSelfRegistrationConfirmEmail syspref. >12) Attempt to register an account on the OPAC again. Confirm the >'confirm email address' field is gone and form works as expected. >13) Re-enable the PatronSelfRegistrationConfirmEmail syspref. >14) Log in to the OPAC and go to your personal details >15) Edit the primary email field >16) Confirm you are able to submit your changes (you should not see an >error about emails not matching). > >Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) > >Signed-off-by: holly <hc@interleaf.ie> >--- > ...PatronSelfRegistrationConfirmEmail_syspref.perl | 6 ++++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/opac.pref | 6 ++++ > .../bootstrap/en/modules/opac-memberentry.tt | 34 ++++++++++++++++++++++ > opac/opac-memberentry.pl | 6 ++++ > 5 files changed, 53 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_24913-add_PatronSelfRegistrationConfirmEmail_syspref.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_24913-add_PatronSelfRegistrationConfirmEmail_syspref.perl b/installer/data/mysql/atomicupdate/bug_24913-add_PatronSelfRegistrationConfirmEmail_syspref.perl >new file mode 100644 >index 0000000000..73ca835feb >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_24913-add_PatronSelfRegistrationConfirmEmail_syspref.perl >@@ -0,0 +1,6 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES ('PatronSelfRegistrationConfirmEmail', '0', NULL, 'Require users to confirm their email address by entering it twice.', 'YesNo') }); >+ >+ NewVersion( $DBversion, 24913, "Add PatronSelfRegistrationConfirmEmail syspref"); >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index c9aa5d9ff5..e39352448c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -491,6 +491,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'), > ('PatronSelfRegistrationBorrowerMandatoryField','surname|firstname',NULL,'Choose the mandatory fields for a patron\'s account, when registering via the OPAC.','free'), > ('PatronSelfRegistrationBorrowerUnwantedField','',NULL,'Name the fields you don\'t want to display when registering a new patron via the OPAC.','free'), >+('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'), > ('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'), >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 339395a5a2..6d7fb65a70 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 >@@ -881,6 +881,12 @@ OPAC: > yes: "Display and prefill" > no: "Do not display and prefill" > - "password and login form after a patron has self registered." >+ - >+ - pref: PatronSelfRegistrationConfirmEmail >+ choices: >+ yes: Require >+ no: "Do not require" >+ - users to confirm their email address by entering it twice. > > Advanced search options: > - >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 8761cc88ae..35af40224f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -93,6 +93,9 @@ > [% IF field == "duplicate_email" %] > <li>This email address already exists in our database.</li> > [% END %] >+ [% IF field == "email_match" %] >+ <li>Emails do not match! <a href="#borrower_repeat_email">confirm email address</a></li> >+ [% END %] > [% END %] > </ul> > <span>Please correct and resubmit.</span> >@@ -554,6 +557,19 @@ > <input type="text" id="borrower_email" name="borrower_email" value="[% borrower.email | html %]" /> > [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %] > </li> >+ >+ [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %] >+ <li> >+ [% IF mandatory.defined('email') %] >+ <label for="borrower_repeat_email" class="required">Confirm primary email:</label> >+ [% ELSE %] >+ <label for="borrower_repeat_email">Confirm primary email:</label> >+ [% END %] >+ >+ <input type="text" id="borrower_repeat_email" name="borrower_repeat_email" autocomplete=off> >+ [% IF mandatory.defined('email') %]<span class="required">Required</span>[% END %] >+ </li> >+ [% END %] > [% END %] > > [% UNLESS hidden.defined('emailpro') %] >@@ -1004,6 +1020,9 @@ > borrower_email: { > email: true > }, >+ borrower_repeat_email: { >+ equalTo: '#borrower_email' >+ }, > borrower_emailpro: { > email: true > }, >@@ -1129,6 +1148,21 @@ > $('#borrower_dateofbirth').val(''); > return false; > }); >+ >+ [% IF action != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %] >+ $("#borrower_email").bind("cut copy paste", function(e){ >+ e.preventDefault(); >+ $("#borrower_email").bind("contextmenu", function(e){ >+ e.preventDefault(); >+ }); >+ }); >+ $("#borrower_repeat_email").bind("cut copy paste", function(e){ >+ e.preventDefault(); >+ $("#borrower_repeat_email").bind("contextmenu", function(e){ >+ e.preventDefault(); >+ }); >+ }); >+ [% END %] > //]]> > </script> > [% INCLUDE 'calendar.inc' %] >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index f657b127a4..faf32e8285 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -433,7 +433,13 @@ sub CheckForInvalidFields { > if ( $patrons_with_same_email ) { > push @invalidFields, "duplicate_email"; > } >+ } elsif ( C4::Context->preference("PatronSelfRegistrationConfirmEmail") >+ && $borrower->{'email'} ne $borrower->{'repeat_email'} >+ && !defined $borrower->{borrowernumber} ) { >+ push @invalidFields, "email_match"; > } >+ # email passed all tests, so prevent attempting to store repeat_email >+ delete $borrower->{'repeat_email'}; > } > if ($borrower->{'emailpro'}) { > push(@invalidFields, "emailpro") if (!Email::Valid->address($borrower->{'emailpro'})); >-- >2.11.0
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 24913
:
102891
|
102946
|
103002
|
103226
|
103273
|
103274
|
103275
|
103308