From 9dcfa1dca4b3e80820cde9d4acacc546c27d6455 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 9 Feb 2024 15:50:02 +0100 Subject: [PATCH] set username or role to auth if they're empty (not set) --- src/Network/Core.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Network/Core.cpp b/src/Network/Core.cpp index 6e29af8..d77ddf3 100755 --- a/src/Network/Core.cpp +++ b/src/Network/Core.cpp @@ -128,6 +128,16 @@ void Parse(std::string Data,SOCKET CSocket){ break; case 'N': if (SubCode == 'c'){ + nlohmann::json Auth = { + {"Auth", LoginAuth ? 1 : 0 }, + }; + if (!Username.empty()) { + Auth["username"] = Username; + } + if (!UserRole.empty()) { + Auth["role"] = UserRole; + } + Data = Auth.dump(); Data = "N{\"Auth\":"+std::to_string(LoginAuth)+",\"username\":\"" + Username + "\",\"role\":\"" + UserRole + "\"}"; }else{ Data = "N" + Login(Data.substr(Data.find(':') + 1));