Description
Christopher Brannon
2023-04-08 23:26:02 UTC
+1 +1 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. 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. Created attachment 153687 [details] [review] Bug 33462: Unit Tests prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/Patron.t Created attachment 153688 [details] [review] Bug 33462: Update Schema Files [DO NOT PUSH] This updates the schema files for Borrower.pm, BorrowerModification.pm, Category.pm, and Deletedborrower.pm. Created attachment 153689 [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', a new column to the categories table 'force_password_reset_when_set_by_staff', and new columns to the borrowers, borrower_modification, and deletedborrowers table 'needs_password_reset' 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 :) 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. I'm getting a merge failure in the sandbox on this bug. TASK [Apply bug 33462 via git-bz in docker container] ************************** fatal: [localhost -> koha-bug33462]: FAILED! => {"changed": true, "cmd": "koha-shell -c 'cd /kohadevbox/koha && yes | git bz apply 33462' bug33462", "delta": "0:00:03.143844", "end": "2023-08-04 15:49:21.744724", "msg": "non-zero return code", "rc": 1, "start": "2023-08-04 15:49:18.600880", "stderr": "error: Failed to merge in the changes.\nhint: Use 'git am --show-current-patch=diff' to see the failed patch\nPatch left in /tmp/Bug-33462-Unit-Tests-4t46gml6.patch", "stderr_lines": ["error: Failed to merge in the changes.", "hint: Use 'git am --show-current-patch=diff' to see the failed patch", "Patch left in /tmp/Bug-33462-Unit-Tests-4t46gml6.patch"], "stdout": "\nBug 33462 - Force password change for new patrons entered by staff\n\n153687 - Bug 33462: Unit Tests\n153688 - Bug 33462: Update Schema Files [DO NOT PUSH]\n153689 - Bug 33462: Add ability to force password change for new patrons entered by staff\n\nApply? [(y)es, (n)o, (i)nteractive] Applying: Bug 33462: Unit Tests\nUsing index info to reconstruct a base tree...\nM\tt/db_dependent/Koha/Patron.t\nFalling back to patching base and 3-way merge...\nAuto-merging t/db_dependent/Koha/Patron.t\nCONFLICT (content): Merge conflict in t/db_dependent/Koha/Patron.t\nPatch failed at 0001 Bug 33462: Unit Tests\nWhen you have resolved this problem run \"git bz apply --continue\".\nIf you would prefer to skip this patch, instead run \"git bz apply --skip\".\nTo restore the original branch and stop patching run \"git bz apply --abort\".", "stdout_lines": ["", "Bug 33462 - Force password change for new patrons entered by staff", "", "153687 - Bug 33462: Unit Tests", "153688 - Bug 33462: Update Schema Files [DO NOT PUSH]", "153689 - Bug 33462: Add ability to force password change for new patrons entered by staff", "", "Apply? [(y)es, (n)o, (i)nteractive] Applying: Bug 33462: Unit Tests", "Using index info to reconstruct a base tree...", "M\tt/db_dependent/Koha/Patron.t", "Falling back to patching base and 3-way merge...", "Auto-merging t/db_dependent/Koha/Patron.t", "CONFLICT (content): Merge conflict in t/db_dependent/Koha/Patron.t", "Patch failed at 0001 Bug 33462: Unit Tests", "When you have resolved this problem run \"git bz apply --continue\".", "If you would prefer to skip this patch, instead run \"git bz apply --skip\".", "To restore the original branch and stop patching run \"git bz apply --abort\"."]} Sam, can you please check. Hi Christopher, thanks for trying to test! Were you using ByWater's sandbox? (In reply to Sam Lau from comment #10) > Hi Christopher, thanks for trying to test! Were you using ByWater's sandbox? I tried applying patch on the testing docker and everything was still applying cleanly. I then tried going to the sandbox (I used ByWater) and after applying it and I did end up getting the same message as you in the provision logs. I'm not sure what the issue is (not very familiar with the sandbox) but I asked Kyle Hall for help and we are both hoping the issue is fixed now. I would say give it another shot (I think Kyle created a sandbox for this bug) and if it still doesn't work let me know and then maybe try another sandbox? Everything looks like it is working good on PTFS Europe sandbox so maybe try that one out! :) Yes, I did use ByWater's sandbox. I'll take a look again. Thanks. Created attachment 154395 [details] [review] Bug 33462: Unit Tests prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/Patron.t Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> Created attachment 154396 [details] [review] Bug 33462: Update Schema Files [DO NOT PUSH] This updates the schema files for Borrower.pm, BorrowerModification.pm, Category.pm, and Deletedborrower.pm. Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> Created attachment 154397 [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', a new column to the categories table 'force_password_reset_when_set_by_staff', and new columns to the borrowers, borrower_modification, and deletedborrowers table 'needs_password_reset' 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: Christopher Brannon <cbrannon@cdalibrary.org> Works as expected and is fantastic! Can't wait to have it in production!!!! 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). (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? Not being the coder, as long as it can achieve the same result, and only applied when the account is staff entered, and not entered through online registration, I would say anything to reduce extras would be positive. But let's see what Sam has to say on this. Sam Lau, do you have any comments? We seem to have lost Sam on this conversation. Hi Christopher, Sorry for the delayed response. I was interning for ByWater last summer when I created this patch and haven't had a chance to look at it since then. However, I am back now and will try to fix things up ASAP. Created attachment 167582 [details] [review] Bug 33462: DB Updates Created attachment 167583 [details] [review] Bug 33462: Update Schema Files [DO NOT PUSH] Created attachment 167584 [details] [review] Bug 33462: Manual Schema Changes Created attachment 167585 [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 :) Created attachment 167586 [details] [review] Bug 33462: Unit Tests prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/Patron.t Created attachment 167587 [details] [review] Bug 33462: (Follow up) Fix Perl Tidy CONFLICT (content): Merge conflict in Koha/Schema/Result/Category.pm Created attachment 167981 [details] [review] Bug 33462: DB Updates Created attachment 167982 [details] [review] Bug 33462: Update Schema Files (Don't push) Created attachment 167983 [details] [review] Bug 33462: Manual Schema Changes (define as boolean) Created attachment 167984 [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 :) Created attachment 167985 [details] [review] Bug 33462: Unit Tests prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/Patron.t Created attachment 167986 [details] [review] Bug 33462: (Follow up) Fix Perl Tidy Should be good to go now, thanks for letting me know Lucas. (In reply to Sam Lau from comment #36) > Should be good to go now, thanks for letting me know Lucas. Hi Sam, I'm seeing the following when I attempt to apply the patch: error: sha1 information is lacking or useless (admin/categories.pl). error: could not build fake ancestor Patch failed at 0001 Bug 33462: (Follow up) Fix Perl Tidy hint: Use 'git am --show-current-patch=diff' to see the failed patch When you have resolved this problem run "git bz apply --continue". If you would prefer to skip this patch, instead run "git bz apply --skip". To restore the original branch and stop patching run "git bz apply --abort". Patch left in /tmp/Bug-33462-Follow-up-Fix-Perl-Tidy-r7k5ya0s.patch Created attachment 168413 [details] [review] Bug 33462: DB Updates Created attachment 168414 [details] [review] Bug 33462: Update Schema Files (Don't push) Created attachment 168415 [details] [review] Bug 33462: Manual Schema Changes (define as boolean) 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 :) Created attachment 168417 [details] [review] Bug 33462: Unit Tests prove t/db_dependent/Koha/Patron/Category.t prove t/db_dependent/Koha/Patron.t Created attachment 168418 [details] [review] Bug 33462: (Follow up) Fix Perl Tidy Created attachment 168452 [details] [review] Bug 33462: DB Updates Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Created attachment 168453 [details] [review] Bug 33462: Update Schema Files (Don't push) Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Created attachment 168454 [details] [review] Bug 33462: Manual Schema Changes (define as boolean) Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> 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> 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> Created attachment 168457 [details] [review] Bug 33462: (Follow up) Fix Perl Tidy Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Did you address comment 18? (In reply to Jonathan Druart from comment #50) > Did you address comment 18? Yes... did I miss something? (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. (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. 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! (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. *** Bug 28980 has been marked as a duplicate of this bug. *** Hi, Wondering if we can get a QA here? :D Liz patch no longer applies Created attachment 171634 [details] [review] Bug 33462: DB Updates Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Created attachment 171635 [details] [review] Bug 33462: Manual Schema Changes (define as boolean) Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> 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> 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> Created attachment 171638 [details] [review] Bug 33462: (Follow up) Fix Perl Tidy Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com> Created attachment 171639 [details] [review] Bug 33462: Update Schema Files (Don't push) Created attachment 171640 [details] [review] Bug 33462: Adjust tests rebased for current main. resetting to "Needs signoff" as there were a lot of merge conflicts and I am not the original author. 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> 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> 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> 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> 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> Created attachment 172035 [details] [review] Bug 33462: Update Schema Files (Don't push) Signed-off-by: Olivier V <olivier.vezina@inLibro.com> Created attachment 172036 [details] [review] Bug 33462: Adjust tests Signed-off-by: Olivier V <olivier.vezina@inLibro.com> 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> 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> 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> 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> 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> 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> 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> Created attachment 172071 [details] [review] Bug 33462: (QA follow-up) Tidy code Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Skipped the last patch Bug 33462: (QA follow-up) Tidy code because it gave me an sha1 error. 1) Database update (fixed in follow-up) We have a mismatch in the sequence of columns: ALTER TABLE categories ADD COLUMN `force_password_reset_when_set_by_staff` TINYINT(1) NULL DEFAULT NULL AFTER `require_strong_password But kohastructure.sql: `noissueschargeguarantorswithguarantees` int(11) DEFAULT NULL COMMENT 'define maximum amount that the guarantors with guarantees of a patron in this category can have outstanding before checkouts are blocked', + `force_password_reset_when_set_by_staff` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category are required to reset password after being created by a staff member', Pushed for 24.11! Well done everyone, thank you! This patchset added a column to the categories table, but not to the spec. Created attachment 173864 [details] [review] Bug 33462: (QA follow-up) Adapt API spec Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Follow-up pushed to main. Created attachment 173865 [details] [review] Bug 33462: Add new system preference to sysprefs.sql Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> DB revs: say_success statement must be inside the if ! column_exists block. Enhancement, no 24.05 backport. |