mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 03:39:17 +01:00
Add option to force browser login
This commit is contained in:
parent
5c4b201873
commit
b4c6638e19
@ -232,6 +232,7 @@ class Config
|
||||
|
||||
// Booleans
|
||||
bool bLogin;
|
||||
bool bForceBrowserLogin;
|
||||
bool bSaveConfig;
|
||||
bool bResetConfig;
|
||||
|
||||
|
6
main.cpp
6
main.cpp
@ -206,6 +206,7 @@ int main(int argc, char *argv[])
|
||||
#ifdef USE_QT_GUI_LOGIN
|
||||
("gui-login", bpo::value<bool>(&Globals::globalConfig.bForceGUILogin)->zero_tokens()->default_value(false), "Login (force GUI login)\nImplies --enable-login-gui")
|
||||
#endif
|
||||
("browser-login", bpo::value<bool>(&Globals::globalConfig.bForceBrowserLogin)->zero_tokens()->default_value(false), "Login (force browser login)")
|
||||
("check-login-status", bpo::value<bool>(&bCheckLoginStatus)->zero_tokens()->default_value(false), "Check login status")
|
||||
("list", bpo::value<std::string>(&sListFormat)->implicit_value("games"), list_format_text.c_str())
|
||||
("download", bpo::value<bool>(&Globals::globalConfig.bDownload)->zero_tokens()->default_value(false), "Download")
|
||||
@ -472,6 +473,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Globals::globalConfig.bForceBrowserLogin)
|
||||
{
|
||||
Globals::globalConfig.bLogin = true;
|
||||
}
|
||||
|
||||
if (Globals::globalConfig.bLogin)
|
||||
{
|
||||
std::string login_conf = Globals::globalConfig.sConfigDirectory + "/login.txt";
|
||||
|
@ -28,6 +28,9 @@ Login (force GUI login)
|
||||
.br
|
||||
Implies \fB\-\-enable\-login\-gui\fR
|
||||
.TP
|
||||
\fB\-\-browser\-login\fR
|
||||
Login (force browser login)
|
||||
.TP
|
||||
\fB\-\-check\-login\-status\fR
|
||||
Check login status
|
||||
.TP
|
||||
|
@ -265,7 +265,7 @@ int Downloader::login()
|
||||
email = Globals::globalConfig.sEmail;
|
||||
password = Globals::globalConfig.sPassword;
|
||||
}
|
||||
else if (!bForceGUI)
|
||||
else if (!(bForceGUI || Globals::globalConfig.bForceBrowserLogin))
|
||||
{
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
/* Attempt to read this stuff from elsewhere */
|
||||
@ -293,13 +293,14 @@ int Downloader::login()
|
||||
}
|
||||
}
|
||||
|
||||
if ((email.empty() || password.empty()) && (!headless && !bForceGUI))
|
||||
if ((email.empty() || password.empty())
|
||||
&& !(Globals::globalConfig.bForceBrowserLogin || headless || bForceGUI)
|
||||
)
|
||||
{
|
||||
std::cerr << "Email and/or password empty" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Login to website and Galaxy API
|
||||
if (Globals::globalConfig.bLogin)
|
||||
{
|
||||
@ -334,7 +335,7 @@ int Downloader::login()
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -326,8 +326,8 @@ std::string Website::LoginGetAuthCode(const std::string& email, const std::strin
|
||||
bRecaptcha = true;
|
||||
}
|
||||
|
||||
// Try normal login if GUI is not forced
|
||||
if (!bForceGUI)
|
||||
// Try normal login if GUI or browser is not forced
|
||||
if (!(bForceGUI || Globals::globalConfig.bForceBrowserLogin))
|
||||
{
|
||||
auth_code = this->LoginGetAuthCodeCurl(login_form_html, email, password);
|
||||
}
|
||||
@ -343,7 +343,7 @@ std::string Website::LoginGetAuthCode(const std::string& email, const std::strin
|
||||
}
|
||||
#endif
|
||||
|
||||
if (auth_code.empty() && bRecaptcha)
|
||||
if ((auth_code.empty() && bRecaptcha) || Globals::globalConfig.bForceBrowserLogin)
|
||||
auth_code = this->LoginGetAuthCodeBrowser(auth_url);
|
||||
|
||||
return auth_code;
|
||||
|
Loading…
Reference in New Issue
Block a user