Summary: | Internal Server Error during self registration 20.11 | ||
---|---|---|---|
Product: | Koha | Reporter: | JanMueck <jan.michael.mueck> |
Component: | OPAC | Assignee: | Agustín Moyano <agustinmoyano> |
Status: | CLOSED FIXED | QA Contact: | Nick Clemens (kidclamp) <nick> |
Severity: | critical | ||
Priority: | P5 - low | CC: | andrew, caroline.cyr-la-rose, david, dcook, fridolin.somers, jonathan.druart, martin.renvoize, mtj, nick |
Version: | Main | Keywords: | rel_20_11_candidate |
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27626 | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This fixes a bug when using self registration and there is no patron category available for selection in the registration form.
|
Version(s) released in: |
21.05.00,20.11.01
|
Circulation function: | |||
Bug Depends on: | 23816 | ||
Bug Blocks: | |||
Attachments: |
Bug 27148: Fix bug on self registration when user category is hidden
Bug 27148: Fix bug on self registration when user category is hidden Bug 27148: Fix bug on self registration when user category is hidden Bug 27148: (follow-up) Fix require_strong variable set Bug 27148: Fix bug on self registration when user category is hidden Bug 27148: (follow-up) Fix require_strong variable set Bug 27148: (QA follow-up) Calculate default_strong_password correctly |
Description
JanMueck
2020-12-03 14:30:28 UTC
*** Bug 27147 has been marked as a duplicate of this bug. *** This bug started because password strength and length now it's defined by patron's category. As Jonathan told me, we've got PatronSelfRegistrationDefaultCategory preference. So I believe we should check if a patron category is visible in the form. If not visible, we should check fi PatronSelfRegistrationDefaultCategory is set with a valid patron category, and get password requirements from it. If PatronSelfRegistrationDefaultCategory is not set, then we should fetch system's default password strength and length (In reply to Agustín Moyano from comment #2) > If PatronSelfRegistrationDefaultCategory is not set, then we should fetch > system's default password strength and length The self registration feature is disabled is this pref is not set. So we don't need to take this case into account. Created attachment 114154 [details] [review] Bug 27148: Fix bug on self registration when user category is hidden This patch fixes the bug when there is no patron category available for selection in self registration form. It uses PatronSelfRegistrationDefaultCategory to get patron's password length and strength. To test: 1. Do not apply this patch 2. Allow SeflRegistration, set PatronSelfRegistrationDefaultCategory to a valid patron category and finally add categorycode to PatronSelfRegistrationBorrowerUnwantedField 3. Go to opac and enter self registration form CHECK => There is no patron category available for selection => Password's info alert shows "Password must contain at least undefined characters" 4. Fill the form setting a password and send. CHECH => You get an exception saying "You must provide a patron's category to validate password's strength and length" 5. Apply this patch and restart_all 6. repeat steps 3 and 4 SUCCESS => Password's info alert message shows a number instead of "undefined" => Password's strength and length checks are working => If you change default category's lenght or strength parameter it get's reflected when you refresh the page => When you click send, patron is saved Created attachment 114161 [details] [review] Bug 27148: Fix bug on self registration when user category is hidden This patch fixes the bug when there is no patron category available for selection in self registration form. It uses PatronSelfRegistrationDefaultCategory to get patron's password length and strength. To test: 1. Do not apply this patch 2. Allow PatronSelfRegistration, set PatronSelfRegistrationDefaultCategory to a valid patron category and finally add categorycode to PatronSelfRegistrationBorrowerUnwantedField 3. Go to opac and enter self registration form CHECK => There is no patron category available for selection => Password's info alert shows "Password must contain at least undefined characters" 4. Fill the form setting a password and send. CHECH => You get an exception saying "You must provide a patron's category to validate password's strength and length" 5. Apply this patch and restart_all 6. repeat steps 3 and 4 SUCCESS => Password's info alert message shows a number instead of "undefined" => Password's strength and length checks are working => If you change default category's lenght or strength parameter it get's reflected when you refresh the page => When you click submit, patron is saved Signed-off-by: David Nind <david@davidnind.com> Notes from testing (koha-testing-docker (KTD)): - Step 2: should be PatronSelfRegistration rather than SeflRegistration, is set to allow by default in KTD; PatronSelfRegistrationDefaultCategory is set to SELFREG as the patron category in KTD - Step 6: . to change the password settings for the patron category go to Administration > Patrons and circulation > Patron category and edit the SELFREG category; combinations of settings to experiment with are Minimum password length and Require strong password . system preferences for password security are minPasswordLength and RequireStrongPassword Everything works as expected with the test plan. (In reply to David Nind from comment #6) > Notes from testing (koha-testing-docker (KTD)): > > - Step 2: should be PatronSelfRegistration rather than SeflRegistration, is > set to allow by default in KTD; PatronSelfRegistrationDefaultCategory is set > to SELFREG as the patron category in KTD > > - Step 6: > . to change the password settings for the patron category go to > Administration > Patrons and circulation > Patron category and edit the > SELFREG category; combinations of settings to experiment with are Minimum > password length and Require strong password > . system preferences for password security are minPasswordLength and > RequireStrongPassword > > Everything works as expected with the test plan. Thanks David for this comments, and testing Created attachment 114235 [details] [review] Bug 27148: Fix bug on self registration when user category is hidden This patch fixes the bug when there is no patron category available for selection in self registration form. It uses PatronSelfRegistrationDefaultCategory to get patron's password length and strength. To test: 1. Do not apply this patch 2. Allow SeflRegistration, set PatronSelfRegistrationDefaultCategory to a valid patron category and finally add categorycode to PatronSelfRegistrationBorrowerUnwantedField 3. Go to opac and enter self registration form CHECK => There is no patron category available for selection => Password's info alert shows "Password must contain at least undefined characters" 4. Fill the form setting a password and send. CHECH => You get an exception saying "You must provide a patron's category to validate password's strength and length" 5. Apply this patch and restart_all 6. repeat steps 3 and 4 SUCCESS => Password's info alert message shows a number instead of "undefined" => Password's strength and length checks are working => If you change default category's lenght or strength parameter it get's reflected when you refresh the page => When you click send, patron is saved Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Works as expected, no regressions found, passes QA scripts. Passing QA. + var require_strong = $('select#borrower_categorycode option:selected').data('pwdStrong')||default_strong_password; This does not work if the category does not have "Require strong password". If the default from syspref is 1, require_strong will always be 1. Created attachment 114290 [details] [review] Bug 27148: (follow-up) Fix require_strong variable set Created attachment 114563 [details] [review] Bug 27148: Fix bug on self registration when user category is hidden This patch fixes the bug when there is no patron category available for selection in self registration form. It uses PatronSelfRegistrationDefaultCategory to get patron's password length and strength. To test: 1. Do not apply this patch 2. Allow SeflRegistration, set PatronSelfRegistrationDefaultCategory to a valid patron category and finally add categorycode to PatronSelfRegistrationBorrowerUnwantedField 3. Go to opac and enter self registration form CHECK => There is no patron category available for selection => Password's info alert shows "Password must contain at least undefined characters" 4. Fill the form setting a password and send. CHECH => You get an exception saying "You must provide a patron's category to validate password's strength and length" 5. Apply this patch and restart_all 6. repeat steps 3 and 4 SUCCESS => Password's info alert message shows a number instead of "undefined" => Password's strength and length checks are working => If you change default category's lenght or strength parameter it get's reflected when you refresh the page => When you click send, patron is saved Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 114564 [details] [review] Bug 27148: (follow-up) Fix require_strong variable set Created attachment 114565 [details] [review] Bug 27148: (QA follow-up) Calculate default_strong_password correctly Fix a typo lenght for length If category strong password is not set, then we fall back to the preference, but that can be "" - which should be treated as 0 Pushed to master for 21.05, thanks to everybody involved! Pushed to 20.11.x for 20.11.01 Missing dependencies, not backported to 20.05 |