mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-01 23:46:59 +00:00
Merge pull request #105 from WiserTixx/id-from-auth
Send id from auth to game
This commit is contained in:
commit
a60ff48c08
@ -39,6 +39,7 @@ bool Terminate = false;
|
|||||||
bool LoginAuth = false;
|
bool LoginAuth = false;
|
||||||
std::string Username = "";
|
std::string Username = "";
|
||||||
std::string UserRole = "";
|
std::string UserRole = "";
|
||||||
|
int UserID = -1;
|
||||||
std::string UlStatus;
|
std::string UlStatus;
|
||||||
std::string MStatus;
|
std::string MStatus;
|
||||||
bool ModLoaded;
|
bool ModLoaded;
|
||||||
@ -180,6 +181,9 @@ void Parse(std::string Data, SOCKET CSocket) {
|
|||||||
if (!UserRole.empty()) {
|
if (!UserRole.empty()) {
|
||||||
Auth["role"] = UserRole;
|
Auth["role"] = UserRole;
|
||||||
}
|
}
|
||||||
|
if (UserID != -1) {
|
||||||
|
Auth["id"] = UserID;
|
||||||
|
}
|
||||||
Data = "N" + Auth.dump();
|
Data = "N" + Auth.dump();
|
||||||
} else {
|
} else {
|
||||||
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
Data = "N" + Login(Data.substr(Data.find(':') + 1));
|
||||||
|
@ -18,6 +18,7 @@ std::string PrivateKey;
|
|||||||
extern bool LoginAuth;
|
extern bool LoginAuth;
|
||||||
extern std::string Username;
|
extern std::string Username;
|
||||||
extern std::string UserRole;
|
extern std::string UserRole;
|
||||||
|
extern int UserID;
|
||||||
|
|
||||||
void UpdateKey(const char* newKey) {
|
void UpdateKey(const char* newKey) {
|
||||||
if (newKey && std::isalnum(newKey[0])) {
|
if (newKey && std::isalnum(newKey[0])) {
|
||||||
@ -48,6 +49,7 @@ std::string Login(const std::string& fields) {
|
|||||||
if (fields == "LO") {
|
if (fields == "LO") {
|
||||||
Username = "";
|
Username = "";
|
||||||
UserRole = "";
|
UserRole = "";
|
||||||
|
UserID = -1;
|
||||||
LoginAuth = false;
|
LoginAuth = false;
|
||||||
UpdateKey(nullptr);
|
UpdateKey(nullptr);
|
||||||
return "";
|
return "";
|
||||||
@ -74,6 +76,9 @@ std::string Login(const std::string& fields) {
|
|||||||
if (d.contains("role")) {
|
if (d.contains("role")) {
|
||||||
UserRole = d["role"].get<std::string>();
|
UserRole = d["role"].get<std::string>();
|
||||||
}
|
}
|
||||||
|
if (d.contains("id")) {
|
||||||
|
UserID = d["id"].get<int>();
|
||||||
|
}
|
||||||
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());
|
||||||
}
|
}
|
||||||
@ -129,6 +134,9 @@ void CheckLocalKey() {
|
|||||||
if (d.contains("role")) {
|
if (d.contains("role")) {
|
||||||
UserRole = d["role"].get<std::string>();
|
UserRole = d["role"].get<std::string>();
|
||||||
}
|
}
|
||||||
|
if (d.contains("id")) {
|
||||||
|
UserID = d["id"].get<int>();
|
||||||
|
}
|
||||||
// info(Role);
|
// info(Role);
|
||||||
} else {
|
} else {
|
||||||
info("Auto-Authentication unsuccessful please re-login!");
|
info("Auto-Authentication unsuccessful please re-login!");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user