Bug 37104: (Follow up) Restructure checkpw code

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 99b2fab569)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Sam Lau 2024-06-17 19:25:34 +00:00 committed by Lucas Gass
parent 74c9551f91
commit e5afec77f2
1 changed files with 4 additions and 5 deletions

View File

@ -1414,8 +1414,8 @@ sub checkauth {
my $auth_template_name = ( $type eq 'opac' ) ? 'opac-auth.tt' : 'auth.tt';
my $template = C4::Templates::gettemplate( $auth_template_name, $type, $query );
my $borrowernumber = $patron and $patron->borrowernumber;
my $anonymous_patron = C4::Context->preference('AnonymousPatron');
my $borrowernumber = $patron and $patron->borrowernumber;
my $anonymous_patron = C4::Context->preference('AnonymousPatron');
my $is_anonymous_patron = $patron && ( $patron->borrowernumber eq $anonymous_patron );
$template->param(
@ -2063,10 +2063,9 @@ sub checkpw {
@return = ();
} elsif ($passwd_ok) {
$patron->update( { login_attempts => 0 } );
if ( $patron->password_expired ) {
@return = ( -2, $patron );
}
if ( $patron->borrowernumber eq $anonymous_patron ) {
@return = ( -3, $patron );
} elsif ( $patron->password_expired ) {
@return = ( -2, $patron );
}
} else {