Browse Source

Unset user token if invalid.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
3183508373
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      src/library.cpp

+ 12
- 1
src/library.cpp View File

@@ -158,11 +158,22 @@ void checkUpdates() {
std::string userUrl = API_URL + "/user";
json_t* userResJ = network::requestJson(network::METHOD_GET, userUrl, NULL, getTokenCookies());
if (!userResJ) {
DEBUG("User failed");
WARN("Request for user account failed");
updateStatus = "Could not query user account";
return;
}
DEFER({json_decref(userResJ);});

json_t* userErrorJ = json_object_get(userResJ, "error");
if (userErrorJ) {
std::string userError = json_string_value(userErrorJ);
WARN("Request for user account error: %s", userError.c_str());
// Unset token
settings::token = "";
refreshRequested = true;
return;
}

// Get library manifests
std::string manifestsUrl = API_URL + "/library/manifests";
json_t* manifestsReq = json_object();


Loading…
Cancel
Save