Bug 21890 - Allow forgotten password functionality to be limited by patron category
Summary: Allow forgotten password functionality to be limited by patron category
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL:
Keywords:
: 3032 (view as bug list)
Depends on:
Blocks: 10796
  Show dependency treegraph
 
Reported: 2018-11-27 16:48 UTC by Jesse Maseto
Modified: 2020-11-17 20:06 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Libraries can now specify which patrons are allowed to change their password through the Forgotten Password functionality in the OPAC, per patron category. A common use case for this would be a system that combines LDAP (or other external authentication) patrons and local Koha patrons. This feature will allow libraries to present a better user experience for password management to all of their patrons, no matter how they are authenticated.
Version(s) released in:
19.05.00


Attachments
Bug 21890: DB updates (5.99 KB, patch)
2019-01-31 19:53 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (2.85 KB, patch)
2019-01-31 19:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.57 KB, patch)
2019-01-31 19:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (11.01 KB, patch)
2019-01-31 19:54 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: DB updates (6.06 KB, patch)
2019-02-01 15:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (2.92 KB, patch)
2019-02-01 15:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.64 KB, patch)
2019-02-01 15:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (11.08 KB, patch)
2019-02-01 15:37 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 21890: DB updates (2.64 KB, patch)
2019-02-11 19:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.57 KB, patch)
2019-02-11 19:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Add Koha::Patron::Category->effective_reset_password method (4.55 KB, patch)
2019-02-11 19:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (3.16 KB, patch)
2019-02-11 19:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (15.75 KB, patch)
2019-02-11 19:37 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: DBIC update (1.28 KB, patch)
2019-02-11 19:38 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: DB updates (2.63 KB, patch)
2019-03-21 14:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.57 KB, patch)
2019-03-21 14:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Add Koha::Patron::Category->effective_reset_password method (4.55 KB, patch)
2019-03-21 14:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (3.16 KB, patch)
2019-03-21 14:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (15.75 KB, patch)
2019-03-21 14:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: DB updates (2.69 KB, patch)
2019-03-21 19:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.62 KB, patch)
2019-03-21 19:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 21890: Add Koha::Patron::Category->effective_reset_password method (4.60 KB, patch)
2019-03-21 19:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (3.21 KB, patch)
2019-03-21 19:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (15.84 KB, patch)
2019-03-21 19:51 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 21890: Wrap message in span (1.37 KB, patch)
2019-03-22 14:22 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 21890: DB updates (2.74 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: Handle can_reset_password on the staff interface (3.67 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: Add Koha::Patron::Category->effective_reset_password method (4.65 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: Add can_any_reset_password() to the Categories TT plugin (3.26 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: Allow restricting password resets by patron category (15.84 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: Wrap message in span (1.44 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21890: (QA follow-up) Use List::Util::any (1.98 KB, patch)
2019-04-01 17:53 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Maseto 2018-11-27 16:48:47 UTC Comment hidden (obsolete)
Comment 1 Katrin Fischer 2018-11-27 17:10:51 UTC
Kyle, was this supposed to be here? General public has no access to RT :)
Comment 2 Katrin Fischer 2018-11-27 17:11:20 UTC
Ah, sorry, assigned to Kyle, written by Jesse!
Comment 3 Jesse Maseto 2018-11-27 17:35:35 UTC
This enhancement will provide a secure method for a patron to change their Koha password that does not require any staff mediation. This method would be applicable only to selected patron types, controlled by the library with a setting that the library can change without requesting special assistance.

Patrons would be provided with an appropriate link from the OPAC that would lead to a password setting page/UI. Patrons would be required to enter their old password which the system would check to identify and authenticate the patron. New passwords would have to entered twice, would have to match, and would be subject to guidelines for creating passwords (length, required characters, etc.). 

Alternately, patrons who forget their passwords would be able to recover their account and reset their passwords via email.
Comment 4 Katrin Fischer 2018-11-27 17:46:26 UTC
Hi Jesse, thx for the update! But I am not sure how this is different from the existing password reset and password strength features?
Comment 5 Mark Tompsett 2018-11-27 18:00:34 UTC
(In reply to Katrin Fischer from comment #4)
> Hi Jesse, thx for the update! But I am not sure how this is different from
> the existing password reset and password strength features?

It's a level of granularity, not all patrons will be able to reset, just a certain set of them, based on patron type.

As kidclamp clarified on IRC:
<kidclamp> this is to allow it for only certain categories - very useful in a setting with shib or ldap backing
<kidclamp> some patrons should only have they SSO login, others may have a local, they can change via koha
<kidclamp> and it adds some notification, so if password is reset we send an email to notify user (in case of fraud!)
Comment 7 Tomás Cohen Arazi 2019-01-31 19:53:57 UTC Comment hidden (obsolete)
Comment 8 Tomás Cohen Arazi 2019-01-31 19:54:00 UTC Comment hidden (obsolete)
Comment 9 Tomás Cohen Arazi 2019-01-31 19:54:04 UTC Comment hidden (obsolete)
Comment 10 Tomás Cohen Arazi 2019-01-31 19:54:08 UTC Comment hidden (obsolete)
Comment 11 Kyle M Hall 2019-02-01 15:37:24 UTC Comment hidden (obsolete)
Comment 12 Kyle M Hall 2019-02-01 15:37:38 UTC Comment hidden (obsolete)
Comment 13 Kyle M Hall 2019-02-01 15:37:41 UTC Comment hidden (obsolete)
Comment 14 Kyle M Hall 2019-02-01 15:37:44 UTC Comment hidden (obsolete)
Comment 15 Katrin Fischer 2019-02-03 09:18:10 UTC
Hi Tomas,

I think I would have liked a workflow where the value from the global preference is inherited and can be overwritten on category level a little better as this is yet another thing to remember when setting up patron categories (adding more steps and clicks in most use cases). An example for the different behaviour would be: Block expired patrons. (something to consider)

2) NOT allowed = 1 for the column categories.can_reset_password seems counter intuitive? Please check values.

3) The new column is missing from the category overview page and column configuration. I know others appear to be missing too, but I'd consider this a bug as it means you have to open each one to see where you might have made a wrong choice.

4) The message is:
+                    [% ELSIF errNoBorrowerFound %]
+                        <li>You are not allowed to reset your password. Contact library staff for assistance.</li>
                     [% END %]

I think the <li> is wrong here as we are not inside a list and the other message doesn't have it. I think it would be nice to add a span around the message with an id, so if libraries want to change the message it will be easy. The message might read a little harsh to some or they might want to explain.
Comment 16 Tomás Cohen Arazi 2019-02-11 19:37:39 UTC
Created attachment 85001 [details] [review]
Bug 21890: DB updates

This patch adds a new column to the categories table:
'reset_password' which is a boolean, and represents, well... that. The
value itself is nullable.

The idea is that OpacResetPassword governs the general behaviour, and
this can be overriden at category-level.
Comment 17 Tomás Cohen Arazi 2019-02-11 19:37:43 UTC
Created attachment 85002 [details] [review]
Bug 21890: Handle can_reset_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D
Comment 18 Tomás Cohen Arazi 2019-02-11 19:37:46 UTC
Created attachment 85003 [details] [review]
Bug 21890: Add Koha::Patron::Category->effective_reset_password method

This method checks wether the local $self->reset_password is set to
override the OpacResetPassword syspref (i.e. if it is set to a bool) or
undef, in which case if falls back to the value of the syspref.

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 19 Tomás Cohen Arazi 2019-02-11 19:37:51 UTC
Created attachment 85004 [details] [review]
Bug 21890: Add can_any_reset_password() to the Categories TT plugin

This patch introduces a method to the Koha::Template::Plugin::Categories
TT plugin. This methods queries for categories filtering them by
effective_reset_password flag set, and returns a boolean representing the fact
that there's at least one category allowed.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Template/Plugin/Categories.t
=> SUCCESS: Tests pass!
- Sign off :-D

Caveat: this patch/tests require the schema to be updated
Comment 20 Tomás Cohen Arazi 2019-02-11 19:37:56 UTC
Created attachment 85005 [details] [review]
Bug 21890: Allow restricting password resets by patron category

This patch makes the templates relying on the OpacResetPassword syspref
use the introduced TT plugin method instead by changing:

[% IF Koha.Preference('OpacResetPassword') %]

=>

[% IF Categories.can_any_reset_password %]

To test:
- Verify that all the places in which the 'forgot password' link is
displayed in OPAC keep working, provided there's at least one category
that has the flag set
- Attempt to recover the password for a patron that belong to a valid
category (i.e. that has the flag set)
=> SUCCESS: You can go through the normal process
- Attempt to recover the password for a patron that belongs to a
category with the flag unset.
=> SUCCESS: Once Koha identifies your category, you are told you are not
allowed to do it
- Sign off :-D
Comment 21 Tomás Cohen Arazi 2019-02-11 19:38:01 UTC
Created attachment 85006 [details] [review]
Bug 21890: DBIC update
Comment 22 Tomás Cohen Arazi 2019-02-11 19:40:44 UTC
I reworked this so:
- reset_password is a nullable bool. Null means global setting is picked, so 0/1 override global, as requested in comment #1
- #2 is solved, silly mistake
- #3 Will deal with it in a follow-up bug. Can do here if blocker. But there will be another similar bug for password changes... I prefer to solve it for both in a separate bug.
- #4 Solved!
Comment 23 Tomás Cohen Arazi 2019-02-20 15:28:58 UTC
Hold on! Idiomatic issues: I use 'reset' in spanish usually in the context of the 'forgot password' scenario, and I mixed things :-D. The feature is sound, but every place it says 'reset it should say 'recovery'. I will submit a follow-up fixing this mix.
Comment 24 Tomás Cohen Arazi 2019-02-20 16:08:47 UTC
*** Bug 3032 has been marked as a duplicate of this bug. ***
Comment 25 Tomás Cohen Arazi 2019-02-20 17:13:09 UTC
With help from Katrin, I decided to keep it as-is, as it is consistent with how things are named on the UI and the controlling (existing) sysprefs:

- OpacPasswordReset
- OpacChangePassword
Comment 26 Liz Rea 2019-03-12 18:57:29 UTC
Hi Tomas,

I can't seem to get these to apply on latest master:

error: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt).
error: could not build fake ancestor
Patch failed at 0001 Bug 21890: Allow restricting password resets by patron category

Sorry :(

Cheers,
Liz
Comment 27 Tomás Cohen Arazi 2019-03-21 14:23:42 UTC
Created attachment 86843 [details] [review]
Bug 21890: DB updates

This patch adds a new column to the categories table:
'reset_password' which is a boolean, and represents, well... that. The
value itself is nullable.

The idea is that OpacResetPassword governs the general behaviour, and
this can be overriden at category-level.
Comment 28 Tomás Cohen Arazi 2019-03-21 14:23:48 UTC
Created attachment 86844 [details] [review]
Bug 21890: Handle can_reset_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D
Comment 29 Tomás Cohen Arazi 2019-03-21 14:23:54 UTC
Created attachment 86845 [details] [review]
Bug 21890: Add Koha::Patron::Category->effective_reset_password method

This method checks wether the local $self->reset_password is set to
override the OpacResetPassword syspref (i.e. if it is set to a bool) or
undef, in which case if falls back to the value of the syspref.

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 30 Tomás Cohen Arazi 2019-03-21 14:23:59 UTC
Created attachment 86846 [details] [review]
Bug 21890: Add can_any_reset_password() to the Categories TT plugin

This patch introduces a method to the Koha::Template::Plugin::Categories
TT plugin. This methods queries for categories filtering them by
effective_reset_password flag set, and returns a boolean representing the fact
that there's at least one category allowed.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Template/Plugin/Categories.t
=> SUCCESS: Tests pass!
- Sign off :-D

Caveat: this patch/tests require the schema to be updated
Comment 31 Tomás Cohen Arazi 2019-03-21 14:24:04 UTC
Created attachment 86847 [details] [review]
Bug 21890: Allow restricting password resets by patron category

This patch makes the templates relying on the OpacResetPassword syspref
use the introduced TT plugin method instead by changing:

[% IF Koha.Preference('OpacResetPassword') %]

=>

[% IF Categories.can_any_reset_password %]

To test:
- Verify that all the places in which the 'forgot password' link is
displayed in OPAC keep working, provided there's at least one category
that has the flag set
- Attempt to recover the password for a patron that belong to a valid
category (i.e. that has the flag set)
=> SUCCESS: You can go through the normal process
- Attempt to recover the password for a patron that belongs to a
category with the flag unset.
=> SUCCESS: Once Koha identifies your category, you are told you are not
allowed to do it
- Sign off :-D
Comment 32 Tomás Cohen Arazi 2019-03-21 14:25:18 UTC
I resubmitted after checking some merge conflicts. I removed the DBIC update
so run:

$ dbic

on kohadevbox to regenerate them on testing.
Comment 33 Liz Rea 2019-03-21 19:51:06 UTC
Created attachment 86866 [details] [review]
Bug 21890: DB updates

This patch adds a new column to the categories table:
'reset_password' which is a boolean, and represents, well... that. The
value itself is nullable.

The idea is that OpacResetPassword governs the general behaviour, and
this can be overriden at category-level.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 34 Liz Rea 2019-03-21 19:51:09 UTC
Created attachment 86867 [details] [review]
Bug 21890: Handle can_reset_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 35 Liz Rea 2019-03-21 19:51:13 UTC
Created attachment 86868 [details] [review]
Bug 21890: Add Koha::Patron::Category->effective_reset_password method

This method checks wether the local $self->reset_password is set to
override the OpacResetPassword syspref (i.e. if it is set to a bool) or
undef, in which case if falls back to the value of the syspref.

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 36 Liz Rea 2019-03-21 19:51:16 UTC
Created attachment 86869 [details] [review]
Bug 21890: Add can_any_reset_password() to the Categories TT plugin

This patch introduces a method to the Koha::Template::Plugin::Categories
TT plugin. This methods queries for categories filtering them by
effective_reset_password flag set, and returns a boolean representing the fact
that there's at least one category allowed.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Template/Plugin/Categories.t
=> SUCCESS: Tests pass!
- Sign off :-D

Caveat: this patch/tests require the schema to be updated

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 37 Liz Rea 2019-03-21 19:51:19 UTC
Created attachment 86870 [details] [review]
Bug 21890: Allow restricting password resets by patron category

This patch makes the templates relying on the OpacResetPassword syspref
use the introduced TT plugin method instead by changing:

[% IF Koha.Preference('OpacResetPassword') %]

=>

[% IF Categories.can_any_reset_password %]

To test:
- Verify that all the places in which the 'forgot password' link is
displayed in OPAC keep working, provided there's at least one category
that has the flag set
- Attempt to recover the password for a patron that belong to a valid
category (i.e. that has the flag set)
=> SUCCESS: You can go through the normal process
- Attempt to recover the password for a patron that belongs to a
category with the flag unset.
=> SUCCESS: Once Koha identifies your category, you are told you are not
allowed to do it
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 38 Liz Rea 2019-03-21 19:52:58 UTC
Hi,

Quick caveat on the testing here, bug 22559 had to be applied before I could test this properly, and my signoff is dependent on that.

Cheers,
Liz
Comment 39 Tomás Cohen Arazi 2019-03-22 14:22:16 UTC
Created attachment 86911 [details] [review]
Bug 21890: Wrap message in span

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 40 Martin Renvoize 2019-04-01 17:27:24 UTC
Comment on attachment 86869 [details] [review]
Bug 21890: Add can_any_reset_password() to the Categories TT plugin

Review of attachment 86869 [details] [review]:
-----------------------------------------------------------------

::: Koha/Template/Plugin/Categories.pm
@@ +33,5 @@
>      return Koha::Patron::Categories->find( $categorycode )->description;
>  }
>  
> +sub can_any_reset_password {
> +    return ( grep { $_->effective_reset_password } @{ Koha::Patron::Categories->search->as_list } )

I'd prefer a List::Util::any call here: https://metacpan.org/pod/List::Util#any
Comment 41 Martin Renvoize 2019-04-01 17:53:24 UTC
Created attachment 87289 [details] [review]
Bug 21890: DB updates

This patch adds a new column to the categories table:
'reset_password' which is a boolean, and represents, well... that. The
value itself is nullable.

The idea is that OpacResetPassword governs the general behaviour, and
this can be overriden at category-level.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Martin Renvoize 2019-04-01 17:53:27 UTC
Created attachment 87290 [details] [review]
Bug 21890: Handle can_reset_password on the staff interface

This patch makes the staff interface handle the new flag when editing
the categories. I didn't add the flag to the list of categories table
because it makes it too big, but can be easily added if required by
users or QA.

To test:
- Along with other patches from this bug, edit patron categories
=> SUCCESS: Notice the changes are correctly stored
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 43 Martin Renvoize 2019-04-01 17:53:30 UTC
Created attachment 87291 [details] [review]
Bug 21890: Add Koha::Patron::Category->effective_reset_password method

This method checks wether the local $self->reset_password is set to
override the OpacResetPassword syspref (i.e. if it is set to a bool) or
undef, in which case if falls back to the value of the syspref.

To test:
- Apply this patches
- Make sure the DB is updated:
  $ updatedatabase
- Update the schema files:
  $ dbic
- Run:
  $ kshell
 k$ prove t/db_dependent/Koha/Patron/Category.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 44 Martin Renvoize 2019-04-01 17:53:33 UTC
Created attachment 87292 [details] [review]
Bug 21890: Add can_any_reset_password() to the Categories TT plugin

This patch introduces a method to the Koha::Template::Plugin::Categories
TT plugin. This methods queries for categories filtering them by
effective_reset_password flag set, and returns a boolean representing the fact
that there's at least one category allowed.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/Template/Plugin/Categories.t
=> SUCCESS: Tests pass!
- Sign off :-D

Caveat: this patch/tests require the schema to be updated

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 45 Martin Renvoize 2019-04-01 17:53:37 UTC
Created attachment 87293 [details] [review]
Bug 21890: Allow restricting password resets by patron category

This patch makes the templates relying on the OpacResetPassword syspref
use the introduced TT plugin method instead by changing:

[% IF Koha.Preference('OpacResetPassword') %]

=>

[% IF Categories.can_any_reset_password %]

To test:
- Verify that all the places in which the 'forgot password' link is
displayed in OPAC keep working, provided there's at least one category
that has the flag set
- Attempt to recover the password for a patron that belong to a valid
category (i.e. that has the flag set)
=> SUCCESS: You can go through the normal process
- Attempt to recover the password for a patron that belongs to a
category with the flag unset.
=> SUCCESS: Once Koha identifies your category, you are told you are not
allowed to do it
- Sign off :-D

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 46 Martin Renvoize 2019-04-01 17:53:40 UTC
Created attachment 87294 [details] [review]
Bug 21890: Wrap message in span

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 47 Martin Renvoize 2019-04-01 17:53:43 UTC
Created attachment 87295 [details] [review]
Bug 21890: (QA follow-up)  Use List::Util::any

When possible it's a good idea to use `any` from List::Util to shortcut
on the first occurence of a truthy value.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 48 Martin Renvoize 2019-04-01 17:55:09 UTC
Works well, nice clear patches, no regressions and passes the qa scripts (with the notable exception of a false failure for the template plugin)

Passing QA
Comment 49 Nick Clemens 2019-04-12 13:00:24 UTC
Awesome work all!

Pushed to master for 19.05
Comment 50 Martin Renvoize 2019-04-25 13:18:31 UTC
Enhancement will not be backported to 18.11.x series.