Bug 27626 - Patron self-registration breaks if categorycode and password are hidden
Summary: Patron self-registration breaks if categorycode and password are hidden
Status: Pushed to oldoldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 27634
  Show dependency treegraph
 
Reported: 2021-02-04 13:50 UTC by Owen Leonard
Modified: 2021-03-18 21:17 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.04,20.05.10,19.11.16


Attachments
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail (1.93 KB, patch)
2021-02-04 16:42 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail (1.99 KB, patch)
2021-02-09 20:38 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail (2.06 KB, patch)
2021-02-23 09:03 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-02-04 13:50:51 UTC
If categorycode is selected in PatronSelfRegistrationBorrowerUnwantedField, data about password length and password strength is not submitted, causing the submission to fail with an error.

[You must provide a patron's category to validate password's strength and length] at /usr/share/perl5/Exception/Class/Base.pm line 88
Comment 1 Owen Leonard 2021-02-04 14:35:25 UTC
More details: Apparently the problem only occurs if PatronSelfRegistrationVerifyByEmail is turned on.
Comment 2 Jonathan Druart 2021-02-04 16:42:32 UTC
Created attachment 116329 [details] [review]
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail

If categorycode is selected in
PatronSelfRegistrationBorrowerUnwantedField and
PatronSelfRegistrationVerifyByEmail is turned on, the patron self registration
fails with
  [You must provide a patron's category to validate password's strength and length] at /usr/share/perl5/Exception/Class/Base.pm line 88

Test plan:
0. Select categorycode in PatronSelfRegistrationBorrowerUnwantedField
and turn on PatronSelfRegistrationVerifyByEmail
1. Self register a patron
2. Confirm that it works as expected with this patch applied.
Comment 3 Jonathan Druart 2021-02-04 16:45:20 UTC
Is the self registration feature supposed to work if there is no default category defined (PatronSelfRegistrationDefaultCategory)?
The "register here" link is not displayed, but the opac-memberentry.pl is not returning a 404, and the code is trying (badly) to deal with this situation.
If the feature must be turned off if the default cat is not defined, then maybe we should force categorycode in PatronSelfRegistrationBorrowerUnwantedField, and always use the default when a new patron is self-registered.
Comment 4 Owen Leonard 2021-02-09 20:38:28 UTC
Created attachment 116617 [details] [review]
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail

If categorycode is selected in
PatronSelfRegistrationBorrowerUnwantedField and
PatronSelfRegistrationVerifyByEmail is turned on, the patron self registration
fails with

   [You must provide a patron's category to validate password's strength
   and length] at /usr/share/perl5/Exception/Class/Base.pm line 88

Test plan:
0. Select categorycode in PatronSelfRegistrationBorrowerUnwantedField
   and turn on PatronSelfRegistrationVerifyByEmail
1. Self register a patron
2. Confirm that it works as expected with this patch applied.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 5 Katrin Fischer 2021-02-15 20:52:18 UTC
I tried to test this, but ran into bug 27710 and then into:

Invalid 'from' parameter: root@localhost at /usr/share/perl5/Exception/Class/Base.pm line 88

KohAdminEmailAdress is filled, but my system not set up to sent email. 

Any ideas?
Comment 6 Jonathan Druart 2021-02-16 07:37:28 UTC
try: root@example.org
Comment 7 Katrin Fischer 2021-02-16 08:41:15 UTC
Hm, I already tried root@localhost and katrin@something.de so both syntax. Is there some special magic about the one you suggested? And is KohaAdminEmailAddress the one it shoud go into?
Comment 8 Jonathan Druart 2021-02-16 09:28:19 UTC
(In reply to Katrin Fischer from comment #7)
> Hm, I already tried root@localhost and katrin@something.de so both syntax.
> Is there some special magic about the one you suggested? And is
> KohaAdminEmailAddress the one it shoud go into?

katrin@something.de should work, please try again.
Comment 9 Katrin Fischer 2021-02-17 19:14:04 UTC
I've set all the email prefs to katrin@something.de and it doesn't change the error message:

Invalid 'from' parameter: root@localhost at /usr/share/perl5/Exception/Class/Base.pm line 88

I believe it might be related to the SMTP configuration, but I am not sure how to set that up on a devbox.
Comment 10 Jonathan Druart 2021-02-18 10:13:58 UTC
Katrin, here is what I did:

% git checkout -b bug_27626 origin/master
% git bz apply 27626
% reset_all
1. PatronSelfRegistrationVerifyByEmail => require
2. PatronSelfRegistrationBorrowerUnwantedField => categorycode
3. KohaAdminEmailAddress => root@example.org
4. /cgi-bin/koha/opac-memberentry.pl
"A confirmation email will be sent shortly to the email address xxx@example.org."
Comment 11 Jonathan Druart 2021-02-18 10:14:33 UTC
(In reply to Katrin Fischer from comment #9)
> I've set all the email prefs to katrin@something.de and it doesn't change
> the error message:
> 
> Invalid 'from' parameter: root@localhost at
> /usr/share/perl5/Exception/Class/Base.pm line 88
> 
> I believe it might be related to the SMTP configuration, but I am not sure
> how to set that up on a devbox.

No it's not, the error you get is coming from KohaAdminEmailAddress.
Comment 12 Katrin Fischer 2021-02-18 10:45:22 UTC
(In reply to Jonathan Druart from comment #11)
> (In reply to Katrin Fischer from comment #9)
> > I've set all the email prefs to katrin@something.de and it doesn't change
> > the error message:
> > 
> > Invalid 'from' parameter: root@localhost at
> > /usr/share/perl5/Exception/Class/Base.pm line 88
> > 
> > I believe it might be related to the SMTP configuration, but I am not sure
> > how to set that up on a devbox.
> 
> No it's not, the error you get is coming from KohaAdminEmailAddress.

But my KohaAdminEmailAddress was not set to root@localhost - I tried it various times. Maybe someoen else has to take that one.
Comment 13 Martin Renvoize 2021-02-23 09:03:08 UTC
Created attachment 117177 [details] [review]
Bug 27626: Fix self registration if categorycode is hidden and PatronSelfRegistrationVerifyByEmail

If categorycode is selected in
PatronSelfRegistrationBorrowerUnwantedField and
PatronSelfRegistrationVerifyByEmail is turned on, the patron self registration
fails with

   [You must provide a patron's category to validate password's strength
   and length] at /usr/share/perl5/Exception/Class/Base.pm line 88

Test plan:
0. Select categorycode in PatronSelfRegistrationBorrowerUnwantedField
   and turn on PatronSelfRegistrationVerifyByEmail
1. Self register a patron
2. Confirm that it works as expected with this patch applied.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize 2021-02-23 09:03:34 UTC
The patch works well for me and the caveats are livable.

Passing QA
Comment 15 Jonathan Druart 2021-02-23 12:22:02 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 16 Fridolin Somers 2021-02-25 09:31:32 UTC
Pushed to 20.11.x for 20.11.04
Comment 17 Andrew Fuerste-Henry 2021-03-04 21:39:46 UTC
Pushed to 20.05.x for 20.05.10
Comment 18 Victor Grousset/tuxayo 2021-03-18 21:17:33 UTC
Backported: Pushed to 19.11.x branch for 19.11.16