Skip to content

Commit cd0fd7b

Browse files
committed
Fix library
1 parent 68201e8 commit cd0fd7b

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

auth.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <stdexcept>
3838
#include <string>
3939
#include <array>
40-
#include <chrono>
4140

4241
#include <functional>
4342
#include <vector>
@@ -485,7 +484,7 @@ void KeyAuth::api::web_login()
485484
NULL,
486485
NULL
487486
);
488-
487+
489488
if (result == NO_ERROR) {
490489
going = false;
491490
}
@@ -1061,17 +1060,18 @@ std::string KeyAuth::api::fetchonline()
10611060
return onlineusers;
10621061
}
10631062

1064-
void KeyAuth::api::forgot(std::string username, std::string email)
1063+
void KeyAuth::api::forgot(std::string username, std::string email)
10651064
{
10661065
auto data =
10671066
XorStr("type=forgot") +
10681067
XorStr("&username=") + username +
10691068
XorStr("&email=") + email +
1070-
XorStr("&sessionid=") +sessionid +
1069+
XorStr("&sessionid=") + sessionid +
10711070
XorStr("&name=") + name +
10721071
XorStr("&ownerid=") + ownerid;
10731072
auto response = req(data, url);
10741073
auto json = response_decoder.parse(response);
1074+
load_response_data(json);
10751075
}
10761076

10771077
// credits https://stackoverflow.com/a/3790661
@@ -1101,7 +1101,6 @@ std::string get_str_between_two_str(const std::string& s,
11011101
}
11021102

11031103
std::string KeyAuth::api::req(std::string data, std::string url) {
1104-
auto timestart = std::chrono::high_resolution_clock::now();
11051104
CURL* curl = curl_easy_init();
11061105
if (!curl)
11071106
return XorStr("null");
@@ -1130,8 +1129,6 @@ std::string KeyAuth::api::req(std::string data, std::string url) {
11301129
if (code != CURLE_OK)
11311130
error(curl_easy_strerror(code));
11321131

1133-
auto timeend = std::chrono::high_resolution_clock::now();
1134-
KeyAuth::api::data.responsetime = std::chrono::duration_cast<std::chrono::milliseconds>(timestart - timeend).count();
11351132
return to_return;
11361133
}
11371134
void error(std::string message) {
@@ -1314,4 +1311,3 @@ void modify()
13141311
Sleep(50);
13151312
}
13161313
}
1317-

auth.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace KeyAuth {
4747
std::string expiry;
4848
};
4949

50-
static class data_class {
50+
class data_class {
5151
public:
5252
// app data
5353
std::string numUsers;
@@ -68,13 +68,12 @@ namespace KeyAuth {
6868
std::vector<channel_struct> channeldata;
6969
bool success{};
7070
std::string message;
71-
int responsetime;
7271
};
7372
data_class data;
7473
private:
7574
std::string sessionid, enckey;
7675

77-
std::string req(std::string data, std::string url);
76+
static std::string req(std::string data, std::string url);
7877

7978
void load_user_data(nlohmann::json data) {
8079
api::data.username = data["username"];
@@ -124,6 +123,7 @@ namespace KeyAuth {
124123
api::data.channeldata.push_back(output);
125124
}
126125
}
126+
127127
nlohmann::json response_decoder;
128128

129129
};

0 commit comments

Comments
 (0)