Bugzilla – Attachment 159520 Details for
Bug 35445
OPAC registration verification triggered by email URL scanners
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35445: Require OPAC user to confirm self-registration with button push
Bug-35445-Require-OPAC-user-to-confirm-self-regist.patch (text/plain), 6.33 KB, created by
Martin Renvoize (ashimema)
on 2023-12-04 12:04:57 UTC
(
hide
)
Description:
Bug 35445: Require OPAC user to confirm self-registration with button push
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-12-04 12:04:57 UTC
Size:
6.33 KB
patch
obsolete
>From 454feef54734120e899d777b46516c733a42ec8e Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 4 Dec 2023 05:24:01 +0000 >Subject: [PATCH] Bug 35445: Require OPAC user to confirm self-registration > with button push > >This change requires the OPAC user to confirm self-registration with >a button push when verifying registration using an emailed token. > >Test plan: >0. Apply the patch and koha-plack --reload kohadev >1. Set syspref PatronSelfRegistrationVerifyByEmail to "Don't require" >2. Create a patron using the self-registration on the OPAC >3. Note that no confirmation step is needed when self-registering >4. Set syspref PatronSelfRegistrationVerifyByEmail to "Require" >5. Create a patron using the self-registration on the OPAC >6. Look in message_queue to find the URL with the token to >visit in the browser >7. Visit that URL >8. Note that the page says "Registration pending" and asks you to >click a button labeled "Confirm" >9. Click the button labeled "Confirm" >10. Note that the self-registration is confirmed and details are >shown on the page > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../modules/opac-registration-confirmation.tt | 18 +++++++++- > opac/opac-memberentry.pl | 2 ++ > opac/opac-registration-verify.pl | 34 ++++++++++++++++--- > 3 files changed, 48 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt >index 0bc8e13285d..5a20e523502 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-confirmation.tt >@@ -16,7 +16,11 @@ > <div class="main"> > [% WRAPPER breadcrumbs %] > [% WRAPPER breadcrumb_item bc_active= 1 %] >- <span>Registration complete</span> >+ [% IF ( ! confirmed ) %] >+ <span>Registration pending</span> >+ [% ELSE %] >+ <span>Registration complete</span> >+ [% END %] > [% END %] > [% END #/ WRAPPER breadcrumbs %] > >@@ -42,6 +46,17 @@ > <div class="col order-md-1 maincontent"> > [% END %] > >+ [% IF ( ! confirmed ) %] >+ <div id="registration-pending"> >+ <h1>Registration pending</h1> >+ <p id="confirm-instruction" class="registration-line">Click the button below to confirm registration.</p> >+ <form action="/cgi-bin/koha/opac-registration-verify.pl" method="post" name="confirm_registration" id="confirm_registration"> >+ <input type="hidden" name="token" value="[% token | html %]"> >+ <input type="hidden" name="op" value="confirmed"> >+ <input type="submit" value="Confirm" class="btn btn-primary"> >+ </form> >+ </div> >+ [% ELSE %] > <div id="registration-complete"> > <h1>Registration complete!</h1> > >@@ -80,6 +95,7 @@ > </div> > [% END %] > </div> <!-- /#registration-complete --> >+ [% END %] > </div> <!-- / .col-7/9 --> > > <div class="col-12 col-lg-3 order-md-2"> >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index a0f5a3ace28..51f03fca19a 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -263,6 +263,8 @@ if ( $action eq 'create' ) { > $template->param( password_cleartext => $patron->plain_text_password ); > $template->param( borrower => $patron->unblessed ); > >+ $template->param( confirmed => 1 ); >+ > # If 'AutoEmailNewUser' syspref is on, email user their account details from the 'notice' that matches the user's branchcode. > if ( C4::Context->preference("AutoEmailNewUser") ) { > #look for defined primary email address, if blank - attempt to use borr.email and borr.emailpro instead >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 60a004e18fd..7acbd9d2295 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -41,18 +41,41 @@ unless ( C4::Context->preference('PatronSelfRegistration') ) { > } > > my $token = $cgi->param('token'); >+my $op = $cgi->param('op'); >+my $confirmed; >+if ( $op && $op eq 'confirmed' ) { >+ $confirmed = 1; >+} > my $m = Koha::Patron::Modifications->find( { verification_token => $token } ); > > my ( $template, $borrowernumber, $cookie ); > my ( $error_type, $error_info ); > >+my $rego_found; > if ( >- $m # The token exists and the email is unique if requested >- and not( >- C4::Context->preference('PatronSelfRegistrationEmailMustBeUnique') >- and Koha::Patrons->search( { email => $m->email } )->count >+ $m # The token exists and the email is unique if requested >+ and not(C4::Context->preference('PatronSelfRegistrationEmailMustBeUnique') >+ and Koha::Patrons->search( { email => $m->email } )->count ) > ) >- ) >+{ >+ $rego_found = 1; >+} >+ >+if ( $rego_found >+ and !$confirmed ) >+{ >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-registration-confirmation.tt", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => C4::Context->preference("OpacPublic") ? 1 : 0, >+ } >+ ); >+ $template->param( "token" => $token ); >+} >+elsif ( $rego_found >+ and $confirmed ) > { > my $patron_attrs = $m->unblessed; > $patron_attrs->{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($patron_attrs->{categorycode})); >@@ -88,6 +111,7 @@ if ( > authnotrequired => C4::Context->preference("OpacPublic") ? 1 : 0, > } > ); >+ $template->param( "confirmed" => 1 ); > C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences'); > > $template->param( password_cleartext => $patron->plain_text_password ); >-- >2.43.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 35445
:
159516
|
159520
|
161476