Bugzilla – Attachment 83592 Details for
Bug 21992
Remove Koha::Patron::update_password
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21992: Remove unused Koha::Patron->update_password method
Bug-21992-Remove-unused-KohaPatron-updatepassword-.patch (text/plain), 4.62 KB, created by
Kyle M Hall
on 2019-01-02 14:04:24 UTC
(
hide
)
Description:
Bug 21992: Remove unused Koha::Patron->update_password method
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2019-01-02 14:04:24 UTC
Size:
4.62 KB
patch
obsolete
>From a154e9c19124e6f5f4e607fdb67f890c9fbf1f4b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 26 Dec 2018 13:22:55 -0300 >Subject: [PATCH] Bug 21992: Remove unused Koha::Patron->update_password method > >This patch removes the no longer used method. > >To test: >- Apply this patch >- Run: > $ git grep update_password >=> SUCCESS: Only references are in Auth_with_ldap.pm and not related >- Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patron.pm | 31 +------------------------------ > t/db_dependent/Koha/Patrons.t | 27 +-------------------------- > 2 files changed, 2 insertions(+), 56 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index b10b116e0f..62294eb089 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -276,7 +276,7 @@ sub store { > $self->userid($stored_userid); > } > >- # Password must be updated using $self->update_password >+ # Password must be updated using $self->set_password > $self->password($self_from_storage->password); > > if ( C4::Context->preference('FeeOnChangePatronCategory') >@@ -639,35 +639,6 @@ sub is_going_to_expire { > return 0; > } > >-=head3 update_password >- >-my $updated = $patron->update_password( $userid, $password ); >- >-Update the userid and the password of a patron. >-If the userid already exists, returns and let DBIx::Class warns >-This will add an entry to action_logs if BorrowersLog is set. >- >-=cut >- >-sub update_password { >- my ( $self, $userid, $password ) = @_; >- eval { $self->userid($userid)->store; }; >- return if $@; # Make sure the userid is not already in used by another patron >- >- return 0 if $password eq '****' or $password eq ''; >- >- my $digest = Koha::AuthUtils::hash_password($password); >- $self->update( >- { >- password => $digest, >- login_attempts => 0, >- } >- ); >- >- logaction( "MEMBERS", "CHANGE PASS", $self->borrowernumber, "" ) if C4::Context->preference("BorrowersLog"); >- return $digest; >-} >- > =head3 set_password > > $patron->set_password({ password => $plain_text_password [, skip_validation => 1 ] }); >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index 185644bbde..7258925768 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 34; >+use Test::More tests => 33; > use Test::Warn; > use Test::Exception; > use Test::MockModule; >@@ -208,31 +208,6 @@ subtest 'has_overdues' => sub { > $issue->delete(); > }; > >-subtest 'update_password' => sub { >- plan tests => 7; >- >- t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); >- my $original_userid = $new_patron_1->userid; >- my $original_password = $new_patron_1->password; >- warning_like { $retrieved_patron_1->update_password( $new_patron_2->userid, 'another_password' ) } >- qr{Duplicate entry}, >- 'Koha::Patron->update_password should warn if the userid is already used by another patron'; >- is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, $original_userid, 'Koha::Patron->update_password should not have updated the userid' ); >- is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, $original_password, 'Koha::Patron->update_password should not have updated the userid' ); >- >- my $digest = $retrieved_patron_1->update_password( 'another_nonexistent_userid_1', 'another_password' ); >- is( Koha::Patrons->find( $new_patron_1->borrowernumber )->userid, 'another_nonexistent_userid_1', 'Koha::Patron->update_password should have updated the userid' ); >- is( Koha::Patrons->find( $new_patron_1->borrowernumber )->password, $digest, 'Koha::Patron->update_password should have updated the password' ); >- >- my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $new_patron_1->borrowernumber } )->count; >- is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should have logged' ); >- >- t::lib::Mocks::mock_preference( 'BorrowersLog', 0 ); >- $retrieved_patron_1->update_password( 'yet_another_nonexistent_userid_1', 'another_password' ); >- $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'CHANGE PASS', object => $new_patron_1->borrowernumber } )->count; >- is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); >-}; >- > subtest 'is_expired' => sub { > plan tests => 4; > my $patron = $builder->build({ source => 'Borrower' }); >-- >2.17.2 (Apple Git-113)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21992
:
83494
|
83495
|
83496
|
83497
|
83498
|
83499
|
83500
|
83592
|
83604