Bugzilla – Attachment 148206 Details for
Bug 32426
Make userid generation pluggable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32426: Changes for opac-registration-verify
Bug-32426-Changes-for-opac-registration-verify.patch (text/plain), 5.60 KB, created by
Martin Renvoize (ashimema)
on 2023-03-15 13:43:18 UTC
(
hide
)
Description:
Bug 32426: Changes for opac-registration-verify
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-03-15 13:43:18 UTC
Size:
5.60 KB
patch
obsolete
>From c74e3b648805d94e104b1f8465e20ca140f5d7bb Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 19 Jan 2023 12:01:42 +0100 >Subject: [PATCH] Bug 32426: Changes for opac-registration-verify > >Similar to changes in opac-memberentry. > >Test plan: >Now also enable PatronSelfRegistrationVerifyByEmail. >Make the same change in Patron again with return $self. >Restart all. Self register. Check your email. >Follow the link. Verify that you have a similar alert. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../en/modules/opac-registration-invalid.tt | 7 +++ > opac/opac-registration-verify.pl | 48 +++++++++++-------- > 2 files changed, 34 insertions(+), 21 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-invalid.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-invalid.tt >index e1562f37d2..16bfc5e07c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-invalid.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-registration-invalid.tt >@@ -37,6 +37,13 @@ > <h1>Registration invalid!</h1> > > <p>There were problems processing your registration. Please contact your library for help.</p> >+ [% IF error_type OR error_info %] >+ [% IF error_type == 'Koha::Exceptions::Patron::InvalidUserid' %] >+ <p>Error: Userid is not valid</p> >+ [% ELSE %] >+ <p>Error [% error_type %]: [% error_info %]</p> >+ [% END %] >+ [% END %] > </div> > </div> <!-- /#registration-confirmation-error --> > </div> <!-- /.col-lg-10/12 --> >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index 673507ab3e..8c186dd45a 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -18,6 +18,7 @@ > use Modern::Perl; > > use CGI qw ( -utf8 ); >+use Try::Tiny; > > use C4::Auth qw( get_template_and_user ); > use C4::Output qw( output_html_with_http_headers ); >@@ -42,6 +43,7 @@ my $token = $cgi->param('token'); > my $m = Koha::Patron::Modifications->find( { verification_token => $token } ); > > my ( $template, $borrowernumber, $cookie ); >+my ( $error_type, $error_info ); > > if ( > $m # The token exists and the email is unique if requested >@@ -51,15 +53,6 @@ if ( > ) > ) > { >- ( $template, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-registration-confirmation.tt", >- type => "opac", >- query => $cgi, >- authnotrequired => 1, >- } >- ); >- > my $patron_attrs = $m->unblessed; > $patron_attrs->{password} ||= Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($patron_attrs->{categorycode})); > my $consent_dt = delete $patron_attrs->{gdpr_proc_consent}; >@@ -68,9 +61,15 @@ if ( > delete $patron_attrs->{verification_token}; > delete $patron_attrs->{changed_fields}; > delete $patron_attrs->{extended_attributes}; >- my $patron = Koha::Patron->new( $patron_attrs )->store; > >- Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt; >+ my $patron; >+ try { >+ $patron = Koha::Patron->new( $patron_attrs )->store; >+ Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $patron && $consent_dt; >+ } catch { >+ $error_type = ref($_); >+ $error_info = "$_"; >+ }; > > if ($patron) { > if( $m->extended_attributes ){ >@@ -80,6 +79,14 @@ if ( > } else { > $m->delete(); > } >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-registration-confirmation.tt", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => 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 ); >@@ -132,17 +139,16 @@ if ( > my ($theme, $news_lang, $availablethemes) = C4::Templates::themelanguage(C4::Context->config('opachtdocs'),'opac-registration-confirmation.tt','opac',$cgi); > $template->param( news_lang => $news_lang ); > } >- > } >-else { >- ( $template, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-registration-invalid.tt", >- type => "opac", >- query => $cgi, >- authnotrequired => 1, >- } >- ); >+ >+if( !$template ) { # Missing token, patron exception, etc. >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user({ >+ template_name => "opac-registration-invalid.tt", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => 1, >+ }); >+ $template->param( error_type => $error_type, error_info => $error_info ); > } > > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >2.39.2
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 32426
:
146947
|
146948
|
146949
|
146950
|
146951
|
146952
|
146953
|
146954
|
147252
|
147253
|
147254
|
147255
|
147704
|
147705
|
147706
|
147707
|
147708
|
147709
|
147710
|
147711
|
147712
|
148203
|
148204
|
148205
| 148206 |
148207
|
148208
|
148209
|
148210
|
148211
|
148782
|
148793