Bug 23865

Summary: Throw exceptions from Koha::AuthUtils::is_password_valid
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 23865: Throw exceptions in Koha::AuthUtils::is_valid_password
Bug 23865: Throw exceptions in Koha::AuthUtils::is_valid_password

Description Lari Taskula 2019-10-22 10:28:28 UTC
Exceptions are currently thrown in Koha::Patron->set_password.

We need to validate password (with exceptions) without wanting to set the password.
Comment 1 Lari Taskula 2019-10-22 10:42:37 UTC
Created attachment 94522 [details] [review]
Bug 23865: Throw exceptions in Koha::AuthUtils::is_valid_password

Exceptions are currently thrown in Koha::Patron->set_password.

We need to validate password (with exceptions) without wanting to set
the password.

To test:
1. Make sure is_valid_password is not used anywhere in codebase apart from
   Koha::Patron::set_password (grep -rn 'is_valid_password')
2. prove t/db_dependent/Koha/Patrons.t
   Observe ok 35 - ->set_password
Comment 2 Lari Taskula 2019-10-22 10:43:01 UTC
Created attachment 94523 [details] [review]
Bug 23865: Throw exceptions in Koha::AuthUtils::is_valid_password

Exceptions are currently thrown in Koha::Patron->set_password.

We need to validate password (with exceptions) without wanting to set
the password.

To test:
1. Make sure is_valid_password is not used anywhere in codebase apart from
   Koha::Patron::set_password (grep -rn 'is_valid_password')
2. prove t/db_dependent/Koha/Patrons.t
   Observe ok 35 - ->set_password

Sponsored-by: Koha-Suomi Oy
Comment 3 Jonathan Druart 2019-10-22 10:55:20 UTC
It's "is_password_valid", and it is used in other places:

Koha/AuthUtils.pm:        ( $is_valid, undef ) = is_password_valid( $password );
Koha/Patron.pm:        my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password );
installer/onboarding.pl:        my ( $is_valid, $passworderror) = Koha::AuthUtils::is_password_valid( $firstpassword );
members/memberentry.pl:      my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password );
opac/opac-memberentry.pl:        my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $borrower->{password} );