From 33d71c8a2d679acca92484e8401983dd6db872b8 Mon Sep 17 00:00:00 2001 From: frikky Date: Sat, 27 Mar 2021 16:46:20 +0100 Subject: [PATCH] Fixed session issue --- shared.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shared.go b/shared.go index 11d0196..53ede0a 100644 --- a/shared.go +++ b/shared.go @@ -857,9 +857,10 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U parsedName = session.Id } + //log.Printf("Session: %s", session.Username) // Get session first // Should basically never happen - Userdata, err := GetUser(ctx, parsedName) + user, err := GetUser(ctx, parsedName) if err != nil { log.Printf("[INFO] User with Identifier %s doesn't exist: %s", parsedName, err) return User{}, err @@ -869,12 +870,12 @@ func HandleApiAuthentication(resp http.ResponseWriter, request *http.Request) (U return User{}, errors.New(fmt.Sprintf("Couldn't find user")) } - if Userdata.Session != sessionToken { + if user.Session != sessionToken { return User{}, errors.New("[WARNING] Wrong session token") } // Means session exists, but - return *Userdata, nil + return *user, nil } // Key = apikey