Przeglądaj źródła

fix: User login log message fixed when password matches, but user lookup fails

jamesread 4 miesięcy temu
rodzic
commit
54eb2a6586
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      service/internal/api/api.go

+ 3 - 1
service/internal/api/api.go

@@ -180,8 +180,10 @@ func (api *oliveTinAPI) applyLocalLoginResult(req *apiv1.LocalUserLoginRequest,
 				SameSite: http.SameSiteLaxMode,
 			}
 			response.Header().Set("Set-Cookie", cookie.String())
+			log.WithFields(log.Fields{"username": user.Username}).Info("LocalUserLogin: User logged in successfully.")
+		} else {
+			log.WithFields(log.Fields{"username": req.Username}).Warn("LocalUserLogin: Password matched but user lookup failed.")
 		}
-		log.WithFields(log.Fields{"username": req.Username}).Info("LocalUserLogin: User logged in successfully.")
 	} else {
 		log.WithFields(log.Fields{"username": req.Username}).Warn("LocalUserLogin: User login failed.")
 	}