From 99b2fab56918f7e15183627540641a155e315726 Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Mon, 17 Jun 2024 19:25:34 +0000 Subject: [PATCH] Bug 37104: (Follow up) Restructure checkpw code Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- C4/Auth.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 58a9f15d18..57c05778d1 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1418,8 +1418,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( @@ -2062,10 +2062,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 { -- 2.39.5