Managed users fixed

This commit is contained in:
aunefyren 2023-11-28 18:38:06 +01:00
parent 80720039e8
commit 03364f040b

View file

@ -281,12 +281,17 @@ func ApiWrapperGetStatistics(context *gin.Context) {
userActive = wrapperrUser.Active userActive = wrapperrUser.Active
} }
// If no username and no user_id has been declared at this point, something is wrong. Return error. // 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 { 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.") 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.JSON(http.StatusInternalServerError, gin.H{"error": "User validation error."})
context.Abort() context.Abort()
return 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 { if !userActive {