File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1238,6 +1238,37 @@ void KeyAuth::api::forgot(std::string username, std::string email)
12381238 load_response_data (json);
12391239}
12401240
1241+ void KeyAuth::api::logout () {
1242+ checkInit ();
1243+
1244+ auto data =
1245+ XorStr (" type=logout" ) +
1246+ XorStr (" &sessionid=" ) + sessionid +
1247+ XorStr (" &name=" ) + name +
1248+ XorStr (" &ownerid=" ) + ownerid;
1249+ auto response = req (data, url);
1250+ auto json = response_decoder.parse (response);
1251+ if (json[(XorStr (" success" ))]) {
1252+
1253+ // clear all old user data from program
1254+ user_data.createdate .clear ();
1255+ user_data.ip .clear ();
1256+ user_data.hwid .clear ();
1257+ user_data.lastlogin .clear ();
1258+ user_data.username .clear ();
1259+ user_data.subscriptions .clear ();
1260+
1261+ // clear sessionid
1262+ sessionid.clear ();
1263+
1264+ // clear enckey
1265+ enckey.clear ();
1266+
1267+ }
1268+
1269+ load_response_data (json);
1270+ }
1271+
12411272// credits https://stackoverflow.com/a/3790661
12421273static std::string hexDecode (const std::string& hex)
12431274{
You can’t perform that action at this time.
0 commit comments