mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-04 00:47:23 +00:00
add username to auth packet
This commit is contained in:
parent
9afdfd4d1b
commit
7c1106a46a
@ -24,6 +24,7 @@ bool TCPTerminate = false;
|
|||||||
int DEFAULT_PORT = 4444;
|
int DEFAULT_PORT = 4444;
|
||||||
bool Terminate = false;
|
bool Terminate = false;
|
||||||
bool LoginAuth = false;
|
bool LoginAuth = false;
|
||||||
|
std::string Username = "";
|
||||||
std::string UlStatus;
|
std::string UlStatus;
|
||||||
std::string MStatus;
|
std::string MStatus;
|
||||||
bool ModLoaded;
|
bool ModLoaded;
|
||||||
@ -126,7 +127,7 @@ void Parse(std::string Data,SOCKET CSocket){
|
|||||||
break;
|
break;
|
||||||
case 'N':
|
case 'N':
|
||||||
if (SubCode == 'c'){
|
if (SubCode == 'c'){
|
||||||
Data = "N{\"Auth\":"+std::to_string(LoginAuth)+"}";
|
Data = "N{\"Auth\":"+std::to_string(LoginAuth)+",\"username\":\"" + Username + "\"}";
|
||||||
}else{
|
}else{
|
||||||
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ namespace fs = std::filesystem;
|
|||||||
std::string PublicKey;
|
std::string PublicKey;
|
||||||
std::string PrivateKey;
|
std::string PrivateKey;
|
||||||
extern bool LoginAuth;
|
extern bool LoginAuth;
|
||||||
|
extern std::string Username;
|
||||||
std::string Role;
|
std::string Role;
|
||||||
|
|
||||||
void UpdateKey(const char* newKey){
|
void UpdateKey(const char* newKey){
|
||||||
@ -64,6 +65,9 @@ std::string Login(const std::string& fields){
|
|||||||
}
|
}
|
||||||
if(d.contains("success") && d["success"].get<bool>()){
|
if(d.contains("success") && d["success"].get<bool>()){
|
||||||
LoginAuth = true;
|
LoginAuth = true;
|
||||||
|
if (d.contains("username")) {
|
||||||
|
Username = d["username"].get<std::string>();
|
||||||
|
}
|
||||||
if(!d.contains("private_key")) {
|
if(!d.contains("private_key")) {
|
||||||
UpdateKey(d["private_key"].get<std::string>().c_str());
|
UpdateKey(d["private_key"].get<std::string>().c_str());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user