diff --git a/handlers/auth.go b/handlers/auth.go index db494de..751ac31 100644 --- a/handlers/auth.go +++ b/handlers/auth.go @@ -79,9 +79,12 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) { // make sure username does not exists cleanName := utils.RemoveSpacesFromStr(username) clearPass := utils.RemoveSpacesFromStr(password) - // hash the password with md5 - hash := md5.Sum([]byte(clearPass)) - hashedPass := hex.EncodeToString(hash[:]) + var hashedPass string + if clearPass != "" { + // hash the password with md5 + hash := md5.Sum([]byte(clearPass)) + hashedPass = hex.EncodeToString(hash[:]) + } // check if that user was already in db userstate, err := repo.PlayerGetByName(r.Context(), cleanName) if err != nil || userstate == nil {