Skip to content

Commit c148f0e

Browse files
authored
Update auth.cpp
1 parent e75220f commit c148f0e

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

auth.cpp

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,6 @@ void KeyAuth::api::init()
155155
if ((hasher(result ^ 0xA5A5) & 0xFFFF) == (expectedHash & 0xFFFF))
156156
{
157157
auto json = response_decoder.parse(response);
158-
if (json[(XorStr("ownerid"))] != ownerid) {
159-
LI_FN(exit)(8);
160-
}
161-
162-
std::string message = json[(XorStr("message"))];
163-
164-
load_response_data(json);
165158

166159
if (json[(XorStr("ownerid"))] != ownerid) {
167160
LI_FN(exit)(8);
@@ -188,6 +181,7 @@ void KeyAuth::api::init()
188181
else if (json[(XorStr("message"))] == XorStr("invalidver"))
189182
{
190183
std::string dl = json[(XorStr("download"))];
184+
api::app_data.downloadLink = json[XorStr("download")];
191185
if (dl == "")
192186
{
193187
MessageBoxA(0, XorStr("Version in the loader does match the one on the dashboard, and the download link on dashboard is blank.\n\nTo fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly.").c_str(), NULL, MB_ICONERROR);
@@ -290,26 +284,6 @@ void KeyAuth::api::login(std::string username, std::string password, std::string
290284
file.close();
291285
}
292286

293-
std::string message = json[(XorStr("message"))];
294-
295-
std::hash<int> hasher;
296-
size_t expectedHash = hasher(68);
297-
size_t resultCode = hasher(json[(XorStr("code"))]);
298-
299-
if (!json[(XorStr("success"))] || (json[(XorStr("success"))] && (resultCode == expectedHash))) {
300-
load_response_data(json);
301-
if (json[(XorStr("success"))])
302-
load_user_data(json[(XorStr("info"))]);
303-
304-
if (api::response.message != XorStr("Initialized").c_str()) {
305-
LI_FN(GlobalAddAtomA)(seed.c_str());
306-
307-
std::string file_path = XorStr("C:\\ProgramData\\").c_str() + seed;
308-
std::ofstream file(file_path);
309-
if (file.is_open()) {
310-
file << seed;
311-
file.close();
312-
}
313287
std::string regPath = XorStr("Software\\").c_str() + seed;
314288
HKEY hKey;
315289
LONG result = RegCreateKeyExA(HKEY_CURRENT_USER, regPath.c_str(), 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
@@ -504,10 +478,6 @@ KeyAuth::api::Tfa& KeyAuth::api::Tfa::handleInput(KeyAuth::api& instance) {
504478
instance.disable2fa(code);
505479
}
506480

507-
}
508-
else {
509-
LI_FN(exit)(7);
510-
}
511481
}
512482

513483
void KeyAuth::api::web_login()
@@ -1873,8 +1843,6 @@ void checkRegistry() {
18731843
LI_FN(RegCloseKey)(hKey);
18741844
}
18751845
Sleep(1500); // thread interval
1876-
Sleep(1500); // thread interval
1877-
}
18781846
}
18791847

18801848
std::string checksum()
@@ -1921,9 +1889,13 @@ void RedactField(nlohmann::json& jsonObject, const std::string& fieldName)
19211889
}
19221890
}
19231891

1924-
void debugInfo(std::string data, std::string url, std::string response, std::string headers) {
1892+
void KeyAuth::api::debugInfo(std::string data, std::string url, std::string response, std::string headers) {
19251893
// output debug logs to C:\ProgramData\KeyAuth\Debug\
19261894
1895+
if (!KeyAuth::api::debug) {
1896+
return;
1897+
}
1898+
19271899
std::string redacted_response = "n/a";
19281900
// for logging the headers, since response is not avaliable there
19291901
if (response != "n/a") {

0 commit comments

Comments
 (0)