Bug 26941

Summary: Missing OPAC password recovery error messages
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: OPACAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: andrewfh, caroline.cyr-la-rose, lucas, tomascohen, victor
Version: MainKeywords: Manual
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.01
Bug Depends on: 8753    
Bug Blocks:    
Attachments: Bug 26941: Fix OPAC password recovery error messages
Bug 26941: Fix OPAC password recovery error messages
Bug 26941: Fix OPAC password recovery error messages
Bug 26941: Fix OPAC password recovery error messages

Description Fridolin Somers 2020-11-05 14:47:29 UTC
In OPAC password recovery perl opac/opac-password-recovery.pl
there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt
Comment 1 Fridolin Somers 2020-11-05 15:01:18 UTC
Created attachment 113122 [details] [review]
Bug 26941: Fix OPAC password recovery error messages

In OPAC password recovery perl opac/opac-password-recovery.pl
there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt

This patch fixes several bugs:
- typo in 'use Koha::Patrons' defined twice => 'use Koha::Patron'
- remove vars $errTooManyEmailFound $errBadEmail, not used in any template
- add in template text for error 'errNoBorrowerEmail'

1) Create a patron A with login but no email
2) Create a patron B with login and valid email
3) Go to system preferences set 'OpacResetPassword' to ON
4) Make sure that OpacPasswordChange is also ON
5) Go to 'Forgot your password' in OPAC
6) Enter login if patron A and save
=> You get message 'This account has no email address we can send the email to.'
7) Enter login if patron B and save
=> Password recovery is send, no error message
Comment 2 Tomás Cohen Arazi 2020-11-05 15:09:48 UTC
You should only include Koha::Patrons (once, of course hehe).
Comment 3 Fridolin Somers 2020-11-09 08:50:48 UTC
Created attachment 113303 [details] [review]
Bug 26941: Fix OPAC password recovery error messages

In OPAC password recovery perl opac/opac-password-recovery.pl
there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt

This patch fixes several bugs:
- remove 'use Koha::Patrons' defined twice
- remove vars $errTooManyEmailFound $errBadEmail, not used in any template
- add in template text for error 'errNoBorrowerEmail'

1) Create a patron A with login but no email
2) Create a patron B with login and valid email
3) Go to system preferences set 'OpacResetPassword' to ON
4) Make sure that OpacPasswordChange is also ON
5) Go to 'Forgot your password' in OPAC
6) Enter login if patron A and save
=> You get message 'This account has no email address we can send the email to.'
7) Enter login if patron B and save
=> Password recovery is send, no error message
Comment 4 Lucas Gass 2020-12-03 16:00:00 UTC
Fridolin,

I have encounter a problem while testing this patch. To recreate:

1. apply your patch
2. try opac-password-recovery.pl without an email, I see the new error message
3. in the staff client add an email for the same patron 
4. try opac-password-recovery.pl again, it blows up with the error: 
Invalid 'from' parameter: root@localhost at /usr/share/perl5/Exception/Class/Base.pm line 88
Comment 5 Fridolin Somers 2020-12-07 09:14:08 UTC
(In reply to Lucas Gass from comment #4)
> Fridolin,
> 
> I have encounter a problem while testing this patch. To recreate:
> 
> 1. apply your patch
> 2. try opac-password-recovery.pl without an email, I see the new error
> message
> 3. in the staff client add an email for the same patron 
> 4. try opac-password-recovery.pl again, it blows up with the error: 
> Invalid 'from' parameter: root@localhost at
> /usr/share/perl5/Exception/Class/Base.pm line 88

I think you need to set a real email adress into preference 'KohaAdminEmailAddress'.
You may test without my patch first

Thanks a lot for testing :D
Comment 6 Lucas Gass 2020-12-09 22:51:47 UTC
> I think you need to set a real email adress into preference
> 'KohaAdminEmailAddress'.
> You may test without my patch first
> 
> Thanks a lot for testing :D

That is correct, if I use a real email address I get no such error.
Comment 7 Lucas Gass 2020-12-09 22:53:16 UTC
Created attachment 114291 [details] [review]
Bug 26941: Fix OPAC password recovery error messages

In OPAC password recovery perl opac/opac-password-recovery.pl
there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt

This patch fixes several bugs:
- remove 'use Koha::Patrons' defined twice
- remove vars $errTooManyEmailFound $errBadEmail, not used in any template
- add in template text for error 'errNoBorrowerEmail'

1) Create a patron A with login but no email
2) Create a patron B with login and valid email
3) Go to system preferences set 'OpacResetPassword' to ON
4) Make sure that OpacPasswordChange is also ON
5) Go to 'Forgot your password' in OPAC
6) Enter login if patron A and save
=> You get message 'This account has no email address we can send the email to.'
7) Enter login if patron B and save
=> Password recovery is send, no error message

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Victor Grousset/tuxayo 2020-12-20 16:17:55 UTC
Created attachment 114543 [details] [review]
Bug 26941: Fix OPAC password recovery error messages

In OPAC password recovery perl opac/opac-password-recovery.pl
there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt

This patch fixes several bugs:
- remove 'use Koha::Patrons' defined twice
- remove vars $errTooManyEmailFound $errBadEmail, not used in any template
- add in template text for error 'errNoBorrowerEmail'

1) Create a patron A with login but no email
2) Create a patron B with login and valid email
3) Go to system preferences set 'OpacResetPassword' to ON
4) Make sure that OpacPasswordChange is also ON
5) Go to 'Forgot your password' in OPAC
6) Enter login if patron A and save
=> You get message 'This account has no email address we can send the email to.'
7) Enter login if patron B and save
=> Password recovery is send, no error message

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 9 Victor Grousset/tuxayo 2020-12-20 16:19:26 UTC
works, QA script ok, code looks good
Comment 10 Jonathan Druart 2020-12-21 09:20:16 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 Fridolin Somers 2020-12-28 14:36:57 UTC
Pushed to 20.11.x for 20.11.01
Comment 12 Andrew Fuerste-Henry 2020-12-28 21:27:48 UTC
Doesn't apply cleanly to 20.05. Please rebase if needed.