Bugzilla – Attachment 85392 Details for
Bug 10796
Allow password changes for logged in OPAC users by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10796: Use $category->effective_change_password in the OPAC
Bug-10796-Use-category-effectivechangepassword-in-.patch (text/plain), 6.72 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-02-20 17:09:57 UTC
(
hide
)
Description:
Bug 10796: Use $category->effective_change_password in the OPAC
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-02-20 17:09:57 UTC
Size:
6.72 KB
patch
obsolete
>From 0d9e852ea1e99f6d537b610262a5be9b1f6ad918 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 20 Feb 2019 13:58:35 -0300 >Subject: [PATCH] Bug 10796: Use $category->effective_change_password in the > OPAC > >This patch makes the OPAC pages that rely on OpacPasswordChange use the >current patron's category to make the decision to allow password change >or not. > >It does so by making sure all the places in which OpacPasswordChange was >used, use $logged_in_user->category->effective_change_password instead. > >Special attention is required on the case of opac-registration-verify.pl >in which the use of an unblessed Koha::Patron object is changed in >favour of the blessed object, so we can actually use the new method to >make a decision on the text to display. > >To test: >- Go through the OPAC pages, check that the password change strings and >links are displayed only whne appropriate. >- Sign off :-D >--- > koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt | 4 ++-- > .../en/modules/opac-registration-confirmation.tt | 8 +++++++- > opac/opac-memberentry.pl | 3 --- > opac/opac-passwd.pl | 2 +- > opac/opac-registration-verify.pl | 5 +---- > 6 files changed, 12 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >index 42f073b9fe..976fc13df1 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc >@@ -40,7 +40,7 @@ > <a href="/cgi-bin/koha/opac-tags.pl?mine=1">your tags</a></li> > [% END %] > >- [% IF ( OpacPasswordChange ) %] >+ [% IF logged_in_user.category.effective_change_password %] > [% IF ( passwdview ) %] > <li class="active"> > [% ELSE %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt >index 264f1e9307..9b0239ecbe 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt >@@ -51,7 +51,7 @@ > </div> > [% END # /IF Error_messages %] > >- [% IF ( OpacPasswordChange ) %] >+ [% IF logged_in_user.category.effective_change_password %] > [% IF ( Ask_data ) %] > > <form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post" autocomplete="off"> >@@ -66,7 +66,7 @@ > [% END # /IF Ask_data %] > [% ELSE %] > <div class="alert">You can't change your password.</div> >- [% END # /IF OpacPasswordChange %] >+ [% END # /IF logged_in_user.category.effective_change_password %] > > [% IF ( password_updated ) %] > <div class="alert alert-success"> >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 c788de187e..5a62324d2d 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 >@@ -53,7 +53,13 @@ > </p> > [% END %] > >- <p id="patron-instructions">For your convenience, the login box on this page has been pre-filled with this data. Please log in[% IF OpacPasswordChange %] and change your password[% END %].</p> >+ <p id="patron-instructions"> >+ [% IF borrower.category.effective_change_password %] >+ <span>For your convenience, the login box on this page has been pre-filled with this data. Please log in and change your password.</span> >+ [% ELSE %] >+ <span>For your convenience, the login box on this page has been pre-filled with this data. Please log in.</span> >+ [% END %] >+ </p> > [% END %] > > <div id="PatronSelfRegistrationAdditionalInstructions">[% PatronSelfRegistrationAdditionalInstructions | $raw %]</div> >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index dbb6d99e5c..7fc9226c29 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -205,9 +205,6 @@ if ( $action eq 'create' ) { > } > ); > >- $template->param( OpacPasswordChange => >- C4::Context->preference('OpacPasswordChange') ); >- > $borrower{categorycode} ||= C4::Context->preference('PatronSelfRegistrationDefaultCategory'); > $borrower{password} ||= Koha::AuthUtils::generate_password; > my $consent_dt = delete $borrower{gdpr_proc_consent}; >diff --git a/opac/opac-passwd.pl b/opac/opac-passwd.pl >index 4c72d30c5c..bff0214a9f 100755 >--- a/opac/opac-passwd.pl >+++ b/opac/opac-passwd.pl >@@ -44,7 +44,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > ); > > my $patron = Koha::Patrons->find( $borrowernumber ); >-if ( C4::Context->preference("OpacPasswordChange") ) { >+if ( $patron->category->effective_change_password ) { > if ( $query->param('Oldkey') > && $query->param('Newkey') > && $query->param('Confirm') ) >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index ce78ffa807..91e31c0d8e 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -58,9 +58,6 @@ if ( > } > ); > >- $template->param( >- OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); >- > my $patron_attrs = $m->unblessed; > $patron_attrs->{password} ||= Koha::AuthUtils::generate_password; > my $consent_dt = delete $patron_attrs->{gdpr_proc_consent}; >@@ -76,7 +73,7 @@ if ( > 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 ); >- $template->param( borrower => $patron->unblessed ); >+ $template->param( borrower => $patron ); > $template->param( > PatronSelfRegistrationAdditionalInstructions => > C4::Context->preference( >-- >2.20.1
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 10796
:
85389
|
85390
|
85391
|
85392
|
85393
|
87117
|
87118
|
87119
|
87120
|
87121
|
87296
|
87297
|
87298
|
87299
|
87300