mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 03:39:17 +01:00
Fix rare error for logging in
This commit is contained in:
parent
aba2c3c9c5
commit
b778370a52
@ -142,9 +142,19 @@ class GalaxyConfig
|
||||
return this->filepath;
|
||||
}
|
||||
|
||||
void resetClient() {
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
if(token_json.isMember("client_id")) {
|
||||
token_json["client_id"] = default_client_id;
|
||||
}
|
||||
if(token_json.isMember("client_secret")) {
|
||||
token_json["client_secret"] = default_client_secret;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getClientId()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
if(token_json.isMember("client_id")) {
|
||||
return token_json["client_id"].asString();
|
||||
}
|
||||
@ -154,6 +164,7 @@ class GalaxyConfig
|
||||
|
||||
std::string getClientSecret()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
if(token_json.isMember("client_secret")) {
|
||||
return token_json["client_secret"].asString();
|
||||
}
|
||||
|
@ -264,6 +264,9 @@ std::vector<gameItem> Website::getGames()
|
||||
// Login to GOG website
|
||||
int Website::Login(const std::string& email, const std::string& password)
|
||||
{
|
||||
// Reset client id and client secret to ensure we can log-in
|
||||
Globals::galaxyConf.resetClient();
|
||||
|
||||
int res = 0;
|
||||
std::string postdata;
|
||||
std::ostringstream memory;
|
||||
|
Loading…
Reference in New Issue
Block a user