Lines 173-181
subtest 'update_password' => sub {
Link Here
|
173 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, $original_userid, 'Koha::Patron->update_password should not have updated the userid' ); |
173 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, $original_userid, 'Koha::Patron->update_password should not have updated the userid' ); |
174 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, $original_password, 'Koha::Patron->update_password should not have updated the userid' ); |
174 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, $original_password, 'Koha::Patron->update_password should not have updated the userid' ); |
175 |
|
175 |
|
176 |
$retrieved_patron_1->update_password( 'another_nonexistent_userid_1', 'another_password' ); |
176 |
my $digest = $retrieved_patron_1->update_password( 'another_nonexistent_userid_1', 'another_password' ); |
177 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, 'another_nonexistent_userid_1', 'Koha::Patron->update_password should have updated the userid' ); |
177 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, 'another_nonexistent_userid_1', 'Koha::Patron->update_password should have updated the userid' ); |
178 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, 'another_password', 'Koha::Patron->update_password should have updated the password' ); |
178 |
is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, $digest, 'Koha::Patron->update_password should have updated the password' ); |
179 |
|
179 |
|
180 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $new_patron_1->borrowernumber } )->count; |
180 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $new_patron_1->borrowernumber } )->count; |
181 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should have logged' ); |
181 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should have logged' ); |
Lines 1444-1450
subtest '->store' => sub {
Link Here
|
1444 |
|
1444 |
|
1445 |
# Test password |
1445 |
# Test password |
1446 |
my $password = 'password'; |
1446 |
my $password = 'password'; |
1447 |
$patron_1->password($password)->store; |
1447 |
$patron_1->update_password($patron_1->userid, $password); |
1448 |
like( $patron_1->password, qr|^\$2|, 'Password should be hashed using bcrypt (start with $2)' ); |
1448 |
like( $patron_1->password, qr|^\$2|, 'Password should be hashed using bcrypt (start with $2)' ); |
1449 |
my $digest = $patron_1->password; |
1449 |
my $digest = $patron_1->password; |
1450 |
$patron_1->surname('xxx')->store; |
1450 |
$patron_1->surname('xxx')->store; |