mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Update login check
This commit is contained in:
parent
edc6486637
commit
257b6b0137
@ -66,7 +66,7 @@ class GalaxyConfig
|
||||
bool isExpired()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m);
|
||||
bool bExpired = false;
|
||||
bool bExpired = true; // assume that token is expired
|
||||
intmax_t time_now = time(NULL);
|
||||
if (this->token_json.isMember("expires_at"))
|
||||
bExpired = (time_now > this->token_json["expires_at"].asLargestInt());
|
||||
|
@ -178,15 +178,24 @@ bool Downloader::isLoggedIn()
|
||||
if (!bWebsiteIsLoggedIn)
|
||||
Globals::globalConfig.bLoginHTTP = true;
|
||||
|
||||
bool bGalaxyIsLoggedIn = !gogGalaxy->isTokenExpired();
|
||||
if (!bGalaxyIsLoggedIn)
|
||||
{
|
||||
if (gogGalaxy->refreshLogin())
|
||||
bGalaxyIsLoggedIn = true;
|
||||
else
|
||||
Globals::globalConfig.bLoginHTTP = true;
|
||||
}
|
||||
|
||||
bool bIsLoggedInAPI = gogAPI->isLoggedIn();
|
||||
if (!bIsLoggedInAPI)
|
||||
Globals::globalConfig.bLoginAPI = true;
|
||||
|
||||
/* Only check that website is logged in.
|
||||
/* Check that website and Galaxy API are logged in.
|
||||
Allows users to use most of the functionality without having valid API login credentials.
|
||||
Globals::globalConfig.bLoginAPI can still be set to true at this point which means that if website is not logged in we still try to login to API.
|
||||
*/
|
||||
if (bWebsiteIsLoggedIn)
|
||||
if (bWebsiteIsLoggedIn && bGalaxyIsLoggedIn)
|
||||
bIsLoggedIn = true;
|
||||
|
||||
return bIsLoggedIn;
|
||||
|
Loading…
Reference in New Issue
Block a user