From 1d54596bd3edd296061cdb5526d17eb266e6939d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 31 Oct 2019 10:50:07 +0000 Subject: [PATCH] Bug 22706: (RM follow-up) Restore ability to create disabled accounts The patchset inadvertantly disabled the ability to create disabled user accounts when any check_password plugin was installed. Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 2b079af390..55855247e9 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -224,11 +224,11 @@ sub store { : undef; $self->privacy($default_privacy); - # Make a copy of the plain text password for later use - $self->plain_text_password( $self->password ); - - if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) { - # Call any check_password plugins + # Call any check_password plugins if password is passed + if ( C4::Context->preference('UseKohaPlugins') + && C4::Context->config("enable_plugins") + && $self->password ) + { my @plugins = Koha::Plugins->new()->GetPlugins({ method => 'check_password', }); @@ -238,7 +238,7 @@ sub store { # borrowernumber to the plugin. my $ret = $plugin->check_password( { - password => $self->plain_text_password, + password => $self->password, borrowernumber => $self->borrowernumber } ); @@ -248,6 +248,9 @@ sub store { } } + # Make a copy of the plain text password for later use + $self->plain_text_password( $self->password ); + # Create a disabled account if no password provided $self->password( $self->password ? Koha::AuthUtils::hash_password( $self->password ) -- 2.39.5