Bug 33462 - Force password change for new patrons entered by staff
Summary: Force password change for new patrons entered by staff
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Sam Lau
QA Contact: Kyle M Hall (khall)
URL:
Keywords: Sandbox
: 28980 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-04-08 23:26 UTC by Christopher Brannon
Modified: 2024-09-27 13:02 UTC (History)
22 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 33462: Unit Tests (5.64 KB, patch)
2023-07-19 20:07 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Update Schema Files [DO NOT PUSH] (7.11 KB, patch)
2023-07-19 20:07 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (25.22 KB, patch)
2023-07-19 20:07 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.71 KB, patch)
2023-08-12 23:42 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 33462: Update Schema Files [DO NOT PUSH] (7.17 KB, patch)
2023-08-12 23:42 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (25.28 KB, patch)
2023-08-12 23:42 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 33462: DB Updates (5.20 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Update Schema Files [DO NOT PUSH] (1.54 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (1.17 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (13.93 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.46 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (13.79 KB, patch)
2024-06-07 19:42 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.66 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.54 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.19 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (13.93 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.46 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (9.47 KB, patch)
2024-06-21 18:29 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.66 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.54 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.19 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (13.91 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.46 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (9.47 KB, patch)
2024-07-02 22:48 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.72 KB, patch)
2024-07-03 13:28 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.61 KB, patch)
2024-07-03 13:28 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.26 KB, patch)
2024-07-03 13:28 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (13.98 KB, patch)
2024-07-03 13:28 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.53 KB, patch)
2024-07-03 13:29 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (9.53 KB, patch)
2024-07-03 13:29 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.86 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.26 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (13.96 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.38 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (6.47 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.70 KB, patch)
2024-09-17 17:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: Adjust tests (632 bytes, patch)
2024-09-17 17:40 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.91 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.31 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (14.00 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.43 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (6.52 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.75 KB, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: Adjust tests (684 bytes, patch)
2024-09-26 19:18 UTC, Olivier Vezina
Details | Diff | Splinter Review
Bug 33462: DB Updates (3.99 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: Manual Schema Changes (define as boolean) (1.38 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: Add ability to force password change for new patrons entered by staff (14.08 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: Unit Tests (5.50 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: (Follow up) Fix Perl Tidy (6.60 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: Update Schema Files (Don't push) (1.83 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: Adjust tests (758 bytes, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 33462: (QA follow-up) Tidy code (15.07 KB, patch)
2024-09-26 20:15 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2023-04-08 23:26:02 UTC
Patrons that register via OPAC create whatever password they want.  But when staff create a patron account, patrons are given a password.  It would be preferred if patrons were forced to change their password after first logging in when a staff member creates the account.

Unfortunately, the password expiration field is not available when creating the account.  It is only editable after.  It would be ideal if the password field were shown, even when adding a new patron, and the patron category setup page had an option next to expiration settings to force patron to change password at login when entered by staff.  Then, when a staff member is adding the new patron, the date could be defaulted to today.  The OPAC self registration would not need to do this.
Comment 1 koha-US bug tracker 2023-05-10 16:30:14 UTC
+1
Comment 2 George Williams (NEKLS) 2023-05-10 16:30:50 UTC
+1
Comment 3 Christopher Brannon 2023-05-11 19:22:34 UTC
Probably the easiest way to implement this would be to have both a global and patron category enable/disable setting for new patrons created by staff option.  If enabled, when you are entering a new patron on the staff side, the password expiration date would be defaulted to expired as the account is created.  Any other edits would ignore this setting.
Comment 4 Christopher Brannon 2023-05-17 20:03:33 UTC
This feature is rather important for us.  Our consortium wants to stay away from having patron passwords expiring on a regular basis, but we want patrons to get away from default passwords as quickly as possible.  An option for changing the password after a first time login would meet this need.
Comment 5 Sam Lau 2023-07-19 20:07:45 UTC Comment hidden (obsolete)
Comment 6 Sam Lau 2023-07-19 20:07:47 UTC Comment hidden (obsolete)
Comment 7 Sam Lau 2023-07-19 20:07:50 UTC Comment hidden (obsolete)
Comment 8 Sam Lau 2023-07-19 20:33:36 UTC
Hi all, 

I have attempted a solution for this bug and would love any feedback about what you think! Because this is a pretty large patch I figured I'd explain more in depth what the patch actually does here: 

I added a new column to the patron categories that determines whether that type of patron should be forced to reset their password after being created. This column, force_password_reset_when_set_by_staff, is defaulted to follow the new system preference 'ForcePasswordResetWhenSetByStaff', but it also has hard "Force" and "Don't force" options as well. 


If a patron's category allows for it, when a staff member creates a new patron account, the password expiration date is automatically set to an expired date. When they attempt to login to the OPAC, they are sent to a page with a custom error message with a link to reset their password. This message is achieved by adding a new column to the borrowers table 'needs_password_reset' which tracks if a patron needs to reset their password after creation. Upon resetting the password, everything proceeds as usual. 

I also wanted to mention, if testing, it goes a lot faster if you turn on the 'autoMemberNum' preference as well as turn off the 'RequireStrongPassword' preference. This will allow for a much faster patron creation.
Comment 9 Christopher Brannon 2023-08-04 15:51:38 UTC Comment hidden (obsolete)
Comment 10 Sam Lau 2023-08-04 17:01:23 UTC Comment hidden (obsolete)
Comment 11 Sam Lau 2023-08-04 17:12:29 UTC Comment hidden (obsolete)
Comment 12 Sam Lau 2023-08-04 17:34:22 UTC Comment hidden (obsolete)
Comment 13 Christopher Brannon 2023-08-04 22:12:36 UTC Comment hidden (obsolete)
Comment 14 Biblibre Sandboxes 2023-08-12 23:42:35 UTC Comment hidden (obsolete)
Comment 15 Biblibre Sandboxes 2023-08-12 23:42:38 UTC Comment hidden (obsolete)
Comment 16 Biblibre Sandboxes 2023-08-12 23:42:41 UTC Comment hidden (obsolete)
Comment 17 Christopher Brannon 2023-08-12 23:43:36 UTC
Works as expected and is fantastic!  Can't wait to have it in production!!!!
Comment 18 Jonathan Druart 2023-09-01 12:59:20 UTC
1. Please run the QA script and fix the warning (tidy)

2. The manual changes (is_boolean) added to the schema file must be in a separate commit, or it will get lost when pushed

3. indentation is 4 spaces, not 2 (see changes in categories.tt)

4. Could this be achieve without adding a new column (needs_password_reset) but instead compare dateenrolled and password_expiration_date?
If there are the same, then we display "It's your first login", otherwise "Your password has expired". Am I missing something?

5. Not sure how this can behave properly with third-party using the REST API to create patrons (for discussion only).
Comment 19 Christopher Brannon 2023-09-08 16:11:55 UTC Comment hidden (obsolete)
Comment 20 Christopher Brannon 2023-11-02 15:43:59 UTC Comment hidden (obsolete)
Comment 21 Christopher Brannon 2024-03-13 20:54:39 UTC Comment hidden (obsolete)
Comment 22 Sam Lau 2024-06-03 14:13:51 UTC Comment hidden (obsolete)
Comment 23 Sam Lau 2024-06-07 19:42:37 UTC Comment hidden (obsolete)
Comment 24 Sam Lau 2024-06-07 19:42:40 UTC Comment hidden (obsolete)
Comment 25 Sam Lau 2024-06-07 19:42:43 UTC Comment hidden (obsolete)
Comment 26 Sam Lau 2024-06-07 19:42:45 UTC Comment hidden (obsolete)
Comment 27 Sam Lau 2024-06-07 19:42:49 UTC Comment hidden (obsolete)
Comment 28 Sam Lau 2024-06-07 19:42:51 UTC Comment hidden (obsolete)
Comment 29 Lucas 2024-06-19 08:39:19 UTC Comment hidden (obsolete)
Comment 30 Sam Lau 2024-06-21 18:29:23 UTC Comment hidden (obsolete)
Comment 31 Sam Lau 2024-06-21 18:29:26 UTC Comment hidden (obsolete)
Comment 32 Sam Lau 2024-06-21 18:29:29 UTC Comment hidden (obsolete)
Comment 33 Sam Lau 2024-06-21 18:29:32 UTC Comment hidden (obsolete)
Comment 34 Sam Lau 2024-06-21 18:29:35 UTC Comment hidden (obsolete)
Comment 35 Sam Lau 2024-06-21 18:29:38 UTC Comment hidden (obsolete)
Comment 36 Sam Lau 2024-06-21 18:35:44 UTC Comment hidden (obsolete)
Comment 37 Laura Escamilla 2024-06-28 19:32:01 UTC Comment hidden (obsolete)
Comment 38 Sam Lau 2024-07-02 22:48:08 UTC
Created attachment 168413 [details] [review]
Bug 33462: DB Updates
Comment 39 Sam Lau 2024-07-02 22:48:13 UTC
Created attachment 168414 [details] [review]
Bug 33462: Update Schema Files (Don't push)
Comment 40 Sam Lau 2024-07-02 22:48:17 UTC
Created attachment 168415 [details] [review]
Bug 33462: Manual Schema Changes (define as boolean)
Comment 41 Sam Lau 2024-07-02 22:48:21 UTC
Created attachment 168416 [details] [review]
Bug 33462: Add ability to force password change for new patrons entered by staff

This patch attempts to force a password change for new staff created patrons.
This is done by setting the password_expiration_date to an expired date when
adding a new patron. This patch adds a new system preference
'ForcePasswordResetWhenSetByStaff' and a new column to the categories table
'force_password_reset_when_set_by_staff.

To test:
1) Apply patch, restart_all, updatedatabase, and also be sure to update schema.
2) Visit Administration->Sytem Preferences and search for 'EnableExpiredPasswordReset'.
   Make sure this is set to enable. Now search for  'ForcePasswordResetWhenSetByStaff'.
   This should be defaulted to 'Don't force'.
3) Keep that tab open and visit Administration->Patron categories. Click on edit
   on the Board category. Noitce that there is a now a 'Force new patron password reset'
   section. Notice that the by default, this is set to follow the
   ForcePasswordResetWhenSetByStaff system preference (currently set to don't force).
   Click on the dropdown and change it to 'Force'. Save changes
4) Click on the Patrons tab to visit members-home.pl and then click 'New Patron'.
   Select on Patron. Fill in the required information and also enter a password.
5) Submit this form and notice that the patron's password expiration date is set
   to never. This should be the case because the default for 'Force new patron
   password reset' follows the sys. pref. which is still set to 'Don't force' (You
   could have some expiry date in this step, but it should at least be set to a
   date that is not expired. this depends on whether or not you have a defalut
   password expiration date set in patron categories )
6) Log into the OPAC with this patron and notice it works as expected and log in
   was successful.
7) Go back to the patron home page and click to add a new patron. This time select
   'Board'. Once again fill out the required info, enter a password, and then save
   the form.
8) Notice that for this patron, the password expiration date is set for today's
   date. This is because we changed the setting for the 'Board' patron category to
   force.
9) Log into the OPAC with this patron. You should be redirected to a page with an
   error that says: "It's your first login! You need to reset your password." Click
   on the reset password link below this message.
10) You should be sent to a page where you can reset your password. Fill in the
    form and click 'Update password'. Attempt to sign into the OPAC with this new
    password. Everything works as expected.
11) Go back to the staff interface and view this patron's detail page. Notice the
    password expiration date is now set to what the default is in the patron
    category.
12) Edit this patrons information and set their password expiration date to
    yesterday. Go back to the OPAC and try to sign in with this patron again. Note
    that this time, you are also redirected but the message says "Error: Your
    password has expired!"
13) Go back to the staff interface and visit the sys. pref tab we left open. Set
    it to the 'Force' option and save changes.
14) Visit the patron home page and click add patron, now select the patron
    category again. Fill in required info and enter password. Submit form and note
    that the patron's password expiration date is set to today. Try to login to
    the OPAC with this patron, you should be redirected to the page with the error
    that says "Error: It's your first login! You need to reset your password."
15) Sign-off :)
Comment 42 Sam Lau 2024-07-02 22:48:26 UTC
Created attachment 168417 [details] [review]
Bug 33462: Unit Tests

prove t/db_dependent/Koha/Patron/Category.t
prove t/db_dependent/Koha/Patron.t
Comment 43 Sam Lau 2024-07-02 22:48:29 UTC
Created attachment 168418 [details] [review]
Bug 33462: (Follow up) Fix Perl Tidy
Comment 44 Laura Escamilla 2024-07-03 13:28:44 UTC
Created attachment 168452 [details] [review]
Bug 33462: DB Updates

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 45 Laura Escamilla 2024-07-03 13:28:48 UTC
Created attachment 168453 [details] [review]
Bug 33462: Update Schema Files (Don't push)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 46 Laura Escamilla 2024-07-03 13:28:52 UTC
Created attachment 168454 [details] [review]
Bug 33462: Manual Schema Changes (define as boolean)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 47 Laura Escamilla 2024-07-03 13:28:57 UTC
Created attachment 168455 [details] [review]
Bug 33462: Add ability to force password change for new patrons entered by staff

This patch attempts to force a password change for new staff created patrons.
This is done by setting the password_expiration_date to an expired date when
adding a new patron. This patch adds a new system preference
'ForcePasswordResetWhenSetByStaff' and a new column to the categories table
'force_password_reset_when_set_by_staff.

To test:
1) Apply patch, restart_all, updatedatabase, and also be sure to update schema.
2) Visit Administration->Sytem Preferences and search for 'EnableExpiredPasswordReset'.
   Make sure this is set to enable. Now search for  'ForcePasswordResetWhenSetByStaff'.
   This should be defaulted to 'Don't force'.
3) Keep that tab open and visit Administration->Patron categories. Click on edit
   on the Board category. Noitce that there is a now a 'Force new patron password reset'
   section. Notice that the by default, this is set to follow the
   ForcePasswordResetWhenSetByStaff system preference (currently set to don't force).
   Click on the dropdown and change it to 'Force'. Save changes
4) Click on the Patrons tab to visit members-home.pl and then click 'New Patron'.
   Select on Patron. Fill in the required information and also enter a password.
5) Submit this form and notice that the patron's password expiration date is set
   to never. This should be the case because the default for 'Force new patron
   password reset' follows the sys. pref. which is still set to 'Don't force' (You
   could have some expiry date in this step, but it should at least be set to a
   date that is not expired. this depends on whether or not you have a defalut
   password expiration date set in patron categories )
6) Log into the OPAC with this patron and notice it works as expected and log in
   was successful.
7) Go back to the patron home page and click to add a new patron. This time select
   'Board'. Once again fill out the required info, enter a password, and then save
   the form.
8) Notice that for this patron, the password expiration date is set for today's
   date. This is because we changed the setting for the 'Board' patron category to
   force.
9) Log into the OPAC with this patron. You should be redirected to a page with an
   error that says: "It's your first login! You need to reset your password." Click
   on the reset password link below this message.
10) You should be sent to a page where you can reset your password. Fill in the
    form and click 'Update password'. Attempt to sign into the OPAC with this new
    password. Everything works as expected.
11) Go back to the staff interface and view this patron's detail page. Notice the
    password expiration date is now set to what the default is in the patron
    category.
12) Edit this patrons information and set their password expiration date to
    yesterday. Go back to the OPAC and try to sign in with this patron again. Note
    that this time, you are also redirected but the message says "Error: Your
    password has expired!"
13) Go back to the staff interface and visit the sys. pref tab we left open. Set
    it to the 'Force' option and save changes.
14) Visit the patron home page and click add patron, now select the patron
    category again. Fill in required info and enter password. Submit form and note
    that the patron's password expiration date is set to today. Try to login to
    the OPAC with this patron, you should be redirected to the page with the error
    that says "Error: It's your first login! You need to reset your password."
15) Sign-off :)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 48 Laura Escamilla 2024-07-03 13:29:01 UTC
Created attachment 168456 [details] [review]
Bug 33462: Unit Tests

prove t/db_dependent/Koha/Patron/Category.t
prove t/db_dependent/Koha/Patron.t

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 49 Laura Escamilla 2024-07-03 13:29:06 UTC
Created attachment 168457 [details] [review]
Bug 33462: (Follow up) Fix Perl Tidy

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 50 Jonathan Druart 2024-07-10 14:20:08 UTC
Did you address comment 18?
Comment 51 Sam Lau 2024-07-10 14:22:56 UTC
(In reply to Jonathan Druart from comment #50)
> Did you address comment 18?

Yes... did I miss something?
Comment 52 Jonathan Druart 2024-07-11 09:09:34 UTC
(In reply to Jonathan Druart from comment #18)
> 4. Could this be achieve without adding a new column (needs_password_reset)
> but instead compare dateenrolled and password_expiration_date?
> If there are the same, then we display "It's your first login", otherwise
> "Your password has expired". Am I missing something?
> 
> 5. Not sure how this can behave properly with third-party using the REST API
> to create patrons (for discussion only).

What about those 2 points? It seems that the new DB column is still part of the patch set.
Comment 53 Sam Lau 2024-07-11 14:09:35 UTC
(In reply to Jonathan Druart from comment #52)

> What about those 2 points? It seems that the new DB column is still part of
> the patch set.

Originally, there were two nesw DB columns, one for needs_password_reset and one to add it to the patron categories. I got rid of the first one per your request. The one that remains allows it to be a part patron categories if that's what you are referring to.
Comment 54 Jonathan Druart 2024-07-11 14:17:37 UTC
Ok, thanks! Sorry for my laziness!
I usually expect from people to reply with a comment. Even if it's only "all done!", at least I know it has been taken into account :)

Thanks again for your work!
Comment 55 Sam Lau 2024-07-11 14:25:38 UTC
(In reply to Jonathan Druart from comment #54)
> Ok, thanks! Sorry for my laziness!
> I usually expect from people to reply with a comment. Even if it's only "all
> done!", at least I know it has been taken into account :)
> 
No problem, sorry for the misunderstanding. I'll definitely start doing that in the future.
Comment 56 David Cook 2024-08-29 05:57:47 UTC
*** Bug 28980 has been marked as a duplicate of this bug. ***
Comment 57 Liz Rea 2024-09-17 17:06:58 UTC
Hi,
Wondering if we can get a QA here? :D

Liz
Comment 58 Lucas Gass (lukeg) 2024-09-17 17:10:26 UTC
patch no longer applies
Comment 59 Lucas Gass (lukeg) 2024-09-17 17:38:09 UTC
Created attachment 171634 [details] [review]
Bug 33462: DB Updates

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 60 Lucas Gass (lukeg) 2024-09-17 17:38:14 UTC
Created attachment 171635 [details] [review]
Bug 33462: Manual Schema Changes (define as boolean)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 61 Lucas Gass (lukeg) 2024-09-17 17:38:18 UTC
Created attachment 171636 [details] [review]
Bug 33462: Add ability to force password change for new patrons entered by staff

This patch attempts to force a password change for new staff created patrons.
This is done by setting the password_expiration_date to an expired date when
adding a new patron. This patch adds a new system preference
'ForcePasswordResetWhenSetByStaff' and a new column to the categories table
'force_password_reset_when_set_by_staff.

To test:
1) Apply patch, restart_all, updatedatabase, and also be sure to update schema.
2) Visit Administration->Sytem Preferences and search for 'EnableExpiredPasswordReset'.
   Make sure this is set to enable. Now search for  'ForcePasswordResetWhenSetByStaff'.
   This should be defaulted to 'Don't force'.
3) Keep that tab open and visit Administration->Patron categories. Click on edit
   on the Board category. Noitce that there is a now a 'Force new patron password reset'
   section. Notice that the by default, this is set to follow the
   ForcePasswordResetWhenSetByStaff system preference (currently set to don't force).
   Click on the dropdown and change it to 'Force'. Save changes
4) Click on the Patrons tab to visit members-home.pl and then click 'New Patron'.
   Select on Patron. Fill in the required information and also enter a password.
5) Submit this form and notice that the patron's password expiration date is set
   to never. This should be the case because the default for 'Force new patron
   password reset' follows the sys. pref. which is still set to 'Don't force' (You
   could have some expiry date in this step, but it should at least be set to a
   date that is not expired. this depends on whether or not you have a defalut
   password expiration date set in patron categories )
6) Log into the OPAC with this patron and notice it works as expected and log in
   was successful.
7) Go back to the patron home page and click to add a new patron. This time select
   'Board'. Once again fill out the required info, enter a password, and then save
   the form.
8) Notice that for this patron, the password expiration date is set for today's
   date. This is because we changed the setting for the 'Board' patron category to
   force.
9) Log into the OPAC with this patron. You should be redirected to a page with an
   error that says: "It's your first login! You need to reset your password." Click
   on the reset password link below this message.
10) You should be sent to a page where you can reset your password. Fill in the
    form and click 'Update password'. Attempt to sign into the OPAC with this new
    password. Everything works as expected.
11) Go back to the staff interface and view this patron's detail page. Notice the
    password expiration date is now set to what the default is in the patron
    category.
12) Edit this patrons information and set their password expiration date to
    yesterday. Go back to the OPAC and try to sign in with this patron again. Note
    that this time, you are also redirected but the message says "Error: Your
    password has expired!"
13) Go back to the staff interface and visit the sys. pref tab we left open. Set
    it to the 'Force' option and save changes.
14) Visit the patron home page and click add patron, now select the patron
    category again. Fill in required info and enter password. Submit form and note
    that the patron's password expiration date is set to today. Try to login to
    the OPAC with this patron, you should be redirected to the page with the error
    that says "Error: It's your first login! You need to reset your password."
15) Sign-off :)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 62 Lucas Gass (lukeg) 2024-09-17 17:38:22 UTC
Created attachment 171637 [details] [review]
Bug 33462: Unit Tests

prove t/db_dependent/Koha/Patron/Category.t
prove t/db_dependent/Koha/Patron.t

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 63 Lucas Gass (lukeg) 2024-09-17 17:38:26 UTC
Created attachment 171638 [details] [review]
Bug 33462: (Follow up) Fix Perl Tidy

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 64 Lucas Gass (lukeg) 2024-09-17 17:38:30 UTC
Created attachment 171639 [details] [review]
Bug 33462: Update Schema Files (Don't push)
Comment 65 Lucas Gass (lukeg) 2024-09-17 17:40:53 UTC
Created attachment 171640 [details] [review]
Bug 33462: Adjust tests
Comment 66 Lucas Gass (lukeg) 2024-09-17 17:41:53 UTC
rebased for current main. resetting to "Needs signoff" as there were a lot of merge conflicts and I am not the original author.
Comment 67 Olivier Vezina 2024-09-26 19:18:22 UTC
Created attachment 172030 [details] [review]
Bug 33462: DB Updates

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 68 Olivier Vezina 2024-09-26 19:18:26 UTC
Created attachment 172031 [details] [review]
Bug 33462: Manual Schema Changes (define as boolean)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 69 Olivier Vezina 2024-09-26 19:18:29 UTC
Created attachment 172032 [details] [review]
Bug 33462: Add ability to force password change for new patrons entered by staff

This patch attempts to force a password change for new staff created patrons.
This is done by setting the password_expiration_date to an expired date when
adding a new patron. This patch adds a new system preference
'ForcePasswordResetWhenSetByStaff' and a new column to the categories table
'force_password_reset_when_set_by_staff.

To test:
1) Apply patch, restart_all, updatedatabase, and also be sure to update schema.
2) Visit Administration->Sytem Preferences and search for 'EnableExpiredPasswordReset'.
   Make sure this is set to enable. Now search for  'ForcePasswordResetWhenSetByStaff'.
   This should be defaulted to 'Don't force'.
3) Keep that tab open and visit Administration->Patron categories. Click on edit
   on the Board category. Noitce that there is a now a 'Force new patron password reset'
   section. Notice that the by default, this is set to follow the
   ForcePasswordResetWhenSetByStaff system preference (currently set to don't force).
   Click on the dropdown and change it to 'Force'. Save changes
4) Click on the Patrons tab to visit members-home.pl and then click 'New Patron'.
   Select on Patron. Fill in the required information and also enter a password.
5) Submit this form and notice that the patron's password expiration date is set
   to never. This should be the case because the default for 'Force new patron
   password reset' follows the sys. pref. which is still set to 'Don't force' (You
   could have some expiry date in this step, but it should at least be set to a
   date that is not expired. this depends on whether or not you have a defalut
   password expiration date set in patron categories )
6) Log into the OPAC with this patron and notice it works as expected and log in
   was successful.
7) Go back to the patron home page and click to add a new patron. This time select
   'Board'. Once again fill out the required info, enter a password, and then save
   the form.
8) Notice that for this patron, the password expiration date is set for today's
   date. This is because we changed the setting for the 'Board' patron category to
   force.
9) Log into the OPAC with this patron. You should be redirected to a page with an
   error that says: "It's your first login! You need to reset your password." Click
   on the reset password link below this message.
10) You should be sent to a page where you can reset your password. Fill in the
    form and click 'Update password'. Attempt to sign into the OPAC with this new
    password. Everything works as expected.
11) Go back to the staff interface and view this patron's detail page. Notice the
    password expiration date is now set to what the default is in the patron
    category.
12) Edit this patrons information and set their password expiration date to
    yesterday. Go back to the OPAC and try to sign in with this patron again. Note
    that this time, you are also redirected but the message says "Error: Your
    password has expired!"
13) Go back to the staff interface and visit the sys. pref tab we left open. Set
    it to the 'Force' option and save changes.
14) Visit the patron home page and click add patron, now select the patron
    category again. Fill in required info and enter password. Submit form and note
    that the patron's password expiration date is set to today. Try to login to
    the OPAC with this patron, you should be redirected to the page with the error
    that says "Error: It's your first login! You need to reset your password."
15) Sign-off :)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 70 Olivier Vezina 2024-09-26 19:18:33 UTC
Created attachment 172033 [details] [review]
Bug 33462: Unit Tests

prove t/db_dependent/Koha/Patron/Category.t
prove t/db_dependent/Koha/Patron.t

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 71 Olivier Vezina 2024-09-26 19:18:36 UTC
Created attachment 172034 [details] [review]
Bug 33462: (Follow up) Fix Perl Tidy

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 72 Olivier Vezina 2024-09-26 19:18:40 UTC
Created attachment 172035 [details] [review]
Bug 33462: Update Schema Files (Don't push)

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 73 Olivier Vezina 2024-09-26 19:18:44 UTC
Created attachment 172036 [details] [review]
Bug 33462: Adjust tests

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>
Comment 74 Kyle M Hall (khall) 2024-09-26 20:15:20 UTC
Created attachment 172064 [details] [review]
Bug 33462: DB Updates

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 75 Kyle M Hall (khall) 2024-09-26 20:15:30 UTC
Created attachment 172065 [details] [review]
Bug 33462: Manual Schema Changes (define as boolean)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 76 Kyle M Hall (khall) 2024-09-26 20:15:34 UTC
Created attachment 172066 [details] [review]
Bug 33462: Add ability to force password change for new patrons entered by staff

This patch attempts to force a password change for new staff created patrons.
This is done by setting the password_expiration_date to an expired date when
adding a new patron. This patch adds a new system preference
'ForcePasswordResetWhenSetByStaff' and a new column to the categories table
'force_password_reset_when_set_by_staff.

To test:
1) Apply patch, restart_all, updatedatabase, and also be sure to update schema.
2) Visit Administration->Sytem Preferences and search for 'EnableExpiredPasswordReset'.
   Make sure this is set to enable. Now search for  'ForcePasswordResetWhenSetByStaff'.
   This should be defaulted to 'Don't force'.
3) Keep that tab open and visit Administration->Patron categories. Click on edit
   on the Board category. Noitce that there is a now a 'Force new patron password reset'
   section. Notice that the by default, this is set to follow the
   ForcePasswordResetWhenSetByStaff system preference (currently set to don't force).
   Click on the dropdown and change it to 'Force'. Save changes
4) Click on the Patrons tab to visit members-home.pl and then click 'New Patron'.
   Select on Patron. Fill in the required information and also enter a password.
5) Submit this form and notice that the patron's password expiration date is set
   to never. This should be the case because the default for 'Force new patron
   password reset' follows the sys. pref. which is still set to 'Don't force' (You
   could have some expiry date in this step, but it should at least be set to a
   date that is not expired. this depends on whether or not you have a defalut
   password expiration date set in patron categories )
6) Log into the OPAC with this patron and notice it works as expected and log in
   was successful.
7) Go back to the patron home page and click to add a new patron. This time select
   'Board'. Once again fill out the required info, enter a password, and then save
   the form.
8) Notice that for this patron, the password expiration date is set for today's
   date. This is because we changed the setting for the 'Board' patron category to
   force.
9) Log into the OPAC with this patron. You should be redirected to a page with an
   error that says: "It's your first login! You need to reset your password." Click
   on the reset password link below this message.
10) You should be sent to a page where you can reset your password. Fill in the
    form and click 'Update password'. Attempt to sign into the OPAC with this new
    password. Everything works as expected.
11) Go back to the staff interface and view this patron's detail page. Notice the
    password expiration date is now set to what the default is in the patron
    category.
12) Edit this patrons information and set their password expiration date to
    yesterday. Go back to the OPAC and try to sign in with this patron again. Note
    that this time, you are also redirected but the message says "Error: Your
    password has expired!"
13) Go back to the staff interface and visit the sys. pref tab we left open. Set
    it to the 'Force' option and save changes.
14) Visit the patron home page and click add patron, now select the patron
    category again. Fill in required info and enter password. Submit form and note
    that the patron's password expiration date is set to today. Try to login to
    the OPAC with this patron, you should be redirected to the page with the error
    that says "Error: It's your first login! You need to reset your password."
15) Sign-off :)

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 77 Kyle M Hall (khall) 2024-09-26 20:15:38 UTC
Created attachment 172067 [details] [review]
Bug 33462: Unit Tests

prove t/db_dependent/Koha/Patron/Category.t
prove t/db_dependent/Koha/Patron.t

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 78 Kyle M Hall (khall) 2024-09-26 20:15:42 UTC
Created attachment 172068 [details] [review]
Bug 33462: (Follow up) Fix Perl Tidy

Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 79 Kyle M Hall (khall) 2024-09-26 20:15:46 UTC
Created attachment 172069 [details] [review]
Bug 33462: Update Schema Files (Don't push)

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 80 Kyle M Hall (khall) 2024-09-26 20:15:50 UTC
Created attachment 172070 [details] [review]
Bug 33462: Adjust tests

Signed-off-by: Olivier V <olivier.vezina@inLibro.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 81 Kyle M Hall (khall) 2024-09-26 20:15:53 UTC
Created attachment 172071 [details] [review]
Bug 33462: (QA follow-up) Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>