From 03364f040b9813f35b9a164abba6c4c9219e9b7f Mon Sep 17 00:00:00 2001 From: aunefyren Date: Tue, 28 Nov 2023 18:38:06 +0100 Subject: [PATCH] Managed users fixed --- routes/both.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/routes/both.go b/routes/both.go index 9f67d74..cc1b913 100644 --- a/routes/both.go +++ b/routes/both.go @@ -281,12 +281,17 @@ func ApiWrapperGetStatistics(context *gin.Context) { userActive = wrapperrUser.Active } - // If no username and no user_id has been declared at this point, something is wrong. Return error. - if userName == "" || userEmail == "" || userId == 0 { + // If no username, email and no user_id has been declared at this point, and Plex Auth is active, something is wrong. Return error. + if (userName == "" || userEmail == "" || userId == 0) && config.PlexAuth { log.Println("At this point the user should have been verified, but username, email or ID is empty.") context.JSON(http.StatusInternalServerError, gin.H{"error": "User validation error."}) context.Abort() return + } else if userName == "" || userEmail == "" { + log.Println("At this point the user should have been verified, but username or ID is empty.") + context.JSON(http.StatusInternalServerError, gin.H{"error": "User validation error."}) + context.Abort() + return } if !userActive {