Lines 43-48
use Koha::Patron::HouseboundRole;
Link Here
|
43 |
use Koha::Patron::Images; |
43 |
use Koha::Patron::Images; |
44 |
use Koha::Patron::Relationships; |
44 |
use Koha::Patron::Relationships; |
45 |
use Koha::Patrons; |
45 |
use Koha::Patrons; |
|
|
46 |
use Koha::Plugins; |
47 |
use Koha::Plugins::Handler; |
46 |
use Koha::Subscription::Routinglists; |
48 |
use Koha::Subscription::Routinglists; |
47 |
use Koha::Token; |
49 |
use Koha::Token; |
48 |
use Koha::Virtualshelves; |
50 |
use Koha::Virtualshelves; |
Lines 223-232
sub store {
Link Here
|
223 |
: undef; |
225 |
: undef; |
224 |
$self->privacy($default_privacy); |
226 |
$self->privacy($default_privacy); |
225 |
|
227 |
|
226 |
|
|
|
227 |
# Make a copy of the plain text password for later use |
228 |
# Make a copy of the plain text password for later use |
228 |
$self->plain_text_password( $self->password ); |
229 |
$self->plain_text_password( $self->password ); |
229 |
|
230 |
|
|
|
231 |
logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" ) |
232 |
if C4::Context->preference("BorrowersLog"); |
233 |
|
234 |
if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) { |
235 |
# Call any check_password plugins |
236 |
my @plugins = Koha::Plugins->new()->GetPlugins({ |
237 |
method => 'check_password', |
238 |
}); |
239 |
foreach my $plugin ( @plugins ) { |
240 |
# This plugin hook will also be used by a plugin for the Norwegian national |
241 |
# patron database. This is why we need to pass both the password and the |
242 |
# borrowernumber to the plugin. |
243 |
my $ret = Koha::Plugins::Handler->run({ |
244 |
class => ref $plugin, |
245 |
method => 'check_password', |
246 |
params => { |
247 |
password => $self->plain_text_password, |
248 |
borrowernumber => $self->borrowernumber, |
249 |
}, |
250 |
}); |
251 |
if ( $ret->{'error'} == 1 ) { |
252 |
Koha::Exceptions::Password::Plugin->throw(); |
253 |
} |
254 |
} |
255 |
} |
256 |
|
230 |
# Create a disabled account if no password provided |
257 |
# Create a disabled account if no password provided |
231 |
$self->password( $self->password |
258 |
$self->password( $self->password |
232 |
? Koha::AuthUtils::hash_password( $self->password ) |
259 |
? Koha::AuthUtils::hash_password( $self->password ) |
Lines 238-245
sub store {
Link Here
|
238 |
|
265 |
|
239 |
$self->add_enrolment_fee_if_needed(0); |
266 |
$self->add_enrolment_fee_if_needed(0); |
240 |
|
267 |
|
241 |
logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" ) |
|
|
242 |
if C4::Context->preference("BorrowersLog"); |
243 |
} |
268 |
} |
244 |
else { #ModMember |
269 |
else { #ModMember |
245 |
|
270 |
|
Lines 682-687
Exceptions are thrown if the password is not good enough.
Link Here
|
682 |
|
707 |
|
683 |
=item Koha::Exceptions::Password::TooWeak |
708 |
=item Koha::Exceptions::Password::TooWeak |
684 |
|
709 |
|
|
|
710 |
=item Koha::Exceptions::Password::Plugin (if a "check password" plugin is enabled) |
711 |
|
685 |
=back |
712 |
=back |
686 |
|
713 |
|
687 |
=cut |
714 |
=cut |
Lines 712-717
sub set_password {
Link Here
|
712 |
} |
739 |
} |
713 |
} |
740 |
} |
714 |
|
741 |
|
|
|
742 |
if ( C4::Context->preference('UseKohaPlugins') && C4::Context->config("enable_plugins") ) { |
743 |
# Call any check_password plugins |
744 |
my @plugins = Koha::Plugins->new()->GetPlugins({ |
745 |
method => 'check_password', |
746 |
}); |
747 |
foreach my $plugin ( @plugins ) { |
748 |
# This plugin hook will also be used by a plugin for the Norwegian national |
749 |
# patron database. This is why we need to pass both the password and the |
750 |
# borrowernumber to the plugin. |
751 |
my $ret = Koha::Plugins::Handler->run({ |
752 |
class => ref $plugin, |
753 |
method => 'check_password', |
754 |
params => { |
755 |
password => $password, |
756 |
borrowernumber => $self->borrowernumber, |
757 |
}, |
758 |
}); |
759 |
# This plugin hook will also be used by a plugin for the Norwegian national |
760 |
# patron database. This is why we need to call the actual plugins and then |
761 |
# check skip_validation afterwards. |
762 |
if ( $ret->{'error'} == 1 && !$args->{skip_validation} ) { |
763 |
Koha::Exceptions::Password::Plugin->throw(); |
764 |
} |
765 |
} |
766 |
} |
767 |
|
715 |
my $digest = Koha::AuthUtils::hash_password($password); |
768 |
my $digest = Koha::AuthUtils::hash_password($password); |
716 |
$self->update( |
769 |
$self->update( |
717 |
{ password => $digest, |
770 |
{ password => $digest, |