mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2025-07-03 16:37:11 +00:00
Added more error returns on auth fail
This commit is contained in:
parent
5630624757
commit
b7ffa153b1
@ -32,16 +32,23 @@ void UpdateKey(const char* newKey){
|
||||
/// "Guest":"Name"
|
||||
/// "pk":"private_key"
|
||||
|
||||
std::string GetFail(const std::string& R){
|
||||
static std::string DRet = R"({"success":false,"message":)";
|
||||
DRet += "\""+R+"\"}";
|
||||
error(R);
|
||||
return DRet;
|
||||
}
|
||||
|
||||
std::string Login(const std::string& fields){
|
||||
info("Attempting to authenticate...");
|
||||
std::string Buffer = PostHTTP("https://auth.beammp.com/userlogin", fields);
|
||||
json::Document d;
|
||||
d.Parse(Buffer.c_str());
|
||||
if(Buffer == "-1"){
|
||||
fatal("Failed to communicate with the auth system!");
|
||||
return GetFail("Failed to communicate with the auth system!");
|
||||
}
|
||||
if (Buffer.find('{') == -1 || d.HasParseError()) {
|
||||
fatal("Invalid answer from authentication servers, please try again later!");
|
||||
return GetFail("Invalid answer from authentication servers, please try again later!");
|
||||
}
|
||||
if(!d["success"].IsNull() && d["success"].GetBool()){
|
||||
LoginAuth = true;
|
||||
@ -61,7 +68,7 @@ std::string Login(const std::string& fields){
|
||||
d.Accept(writer);
|
||||
return buffer.GetString();
|
||||
}
|
||||
return "{\"success\":false}";
|
||||
return GetFail("Invalid message parsing!");
|
||||
}
|
||||
|
||||
void CheckLocalKey(){
|
||||
|
@ -27,7 +27,7 @@ std::string GetVer(){
|
||||
return "1.80";
|
||||
}
|
||||
std::string GetPatch(){
|
||||
return "";
|
||||
return ".1";
|
||||
}
|
||||
void ReLaunch(int argc,char*args[]){
|
||||
std::string Arg;
|
||||
@ -182,6 +182,7 @@ void InitLauncher(int argc, char* argv[]) {
|
||||
CheckName(argc, argv);
|
||||
CheckLocalKey(); //will replace RequestRole
|
||||
Discord_Main();
|
||||
//Dev = true;
|
||||
//RequestRole();
|
||||
CustomPort(argc, argv);
|
||||
CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch());
|
||||
|
Loading…
x
Reference in New Issue
Block a user