mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Add simple login check as a fallback to current HTTP login check
This commit is contained in:
parent
61cc4187e6
commit
c3916b2c9a
@ -2036,6 +2036,24 @@ int Downloader::HTTP_Login(const std::string& email, const std::string& password
|
||||
break;
|
||||
}
|
||||
|
||||
// Simple login check if complex check failed. Check login by trying to get account page. If response code isn't 200 then login failed.
|
||||
if (res == 0)
|
||||
{
|
||||
std::string url = "https://www.gog.com/account";
|
||||
curl_easy_setopt(curlhandle, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(curlhandle, CURLOPT_FOLLOWLOCATION, 0);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, Downloader::writeMemoryCallback);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_WRITEDATA, &memory);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 1);
|
||||
curl_easy_perform(curlhandle);
|
||||
memory.str(std::string());
|
||||
long int response_code = 0;
|
||||
curl_easy_getinfo(curlhandle, CURLINFO_RESPONSE_CODE, &response_code);
|
||||
curl_easy_setopt(curlhandle, CURLOPT_FOLLOWLOCATION, 1);
|
||||
if (response_code == 200)
|
||||
res = 1; // Login successful
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user