From bd9cb7279cf335354adae981acf9a4f7a7f709a4 Mon Sep 17 00:00:00 2001
From: Sam Lau <samalau@gmail.com>
Date: Mon, 17 Jun 2024 19:25:34 +0000
Subject: [PATCH] Bug 37104: (Follow up) Restructure checkpw code

Signed-off-by: David Nind <david@davidnind.com>
---
 C4/Auth.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index ab6827f615..9158c273c6 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -2058,10 +2058,10 @@ sub checkpw {
     if ($patron) {
         if ($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 );
             }
         } elsif ( !$patron->account_locked ) {
-- 
2.39.2