Don't change globalConfig.bLogin value in Downloader::isLoggedIn

This commit is contained in:
Sude 2021-03-31 15:39:18 +03:00
parent 36181afb4d
commit 04592d512a
2 changed files with 4 additions and 8 deletions

View File

@ -597,11 +597,13 @@ int main(int argc, char *argv[])
int iLoginTries = 0; int iLoginTries = 0;
bool bLoginOK = false; bool bLoginOK = false;
// Login because --login, --login-api or --login-website was used // Login because --login was used
if (Globals::globalConfig.bLogin) if (Globals::globalConfig.bLogin)
bLoginOK = downloader.login(); bLoginOK = downloader.login();
bool bIsLoggedin = downloader.isLoggedIn(); bool bIsLoggedin = downloader.isLoggedIn();
if (!bIsLoggedin)
Globals::globalConfig.bLogin = true;
// Login because we are not logged in // Login because we are not logged in
while (iLoginTries++ < Globals::globalConfig.iRetries && !bIsLoggedin) while (iLoginTries++ < Globals::globalConfig.iRetries && !bIsLoggedin)

View File

@ -133,19 +133,13 @@ Downloader::~Downloader()
bool Downloader::isLoggedIn() bool Downloader::isLoggedIn()
{ {
bool bIsLoggedIn = false; bool bIsLoggedIn = false;
Globals::globalConfig.bLogin= false;
bool bWebsiteIsLoggedIn = gogWebsite->IsLoggedIn(); bool bWebsiteIsLoggedIn = gogWebsite->IsLoggedIn();
if (!bWebsiteIsLoggedIn)
Globals::globalConfig.bLogin = true;
bool bGalaxyIsLoggedIn = !gogGalaxy->isTokenExpired(); bool bGalaxyIsLoggedIn = !gogGalaxy->isTokenExpired();
if (!bGalaxyIsLoggedIn) if (!bGalaxyIsLoggedIn)
{ {
if (gogGalaxy->refreshLogin()) if (gogGalaxy->refreshLogin())
bGalaxyIsLoggedIn = true; bGalaxyIsLoggedIn = true;
else
Globals::globalConfig.bLogin = true;
} }
if (bWebsiteIsLoggedIn && bGalaxyIsLoggedIn) if (bWebsiteIsLoggedIn && bGalaxyIsLoggedIn)