Skip to content

Commit

Permalink
set username or role to auth if they're empty (not set)
Browse files Browse the repository at this point in the history
  • Loading branch information
lionkor committed Feb 9, 2024
1 parent 34399a0 commit d3f5473
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Network/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit d3f5473

Please sign in to comment.