From ea0ec2a9bdac3ac2e7446dbfb2189a6a141e512a Mon Sep 17 00:00:00 2001 From: Sude Date: Fri, 1 Mar 2019 23:12:04 +0200 Subject: [PATCH] Add option to disable GUI login Adds option --disable-login-gui which is used to disable GUI login when reCAPTCHA is encountered on login form. Useful when downloader is compiled with GUI support but user is using it through SSH without X forwarding. --- include/config.h | 3 +++ main.cpp | 3 +++ src/website.cpp | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/include/config.h b/include/config.h index 452c67b..332c605 100644 --- a/include/config.h +++ b/include/config.h @@ -231,6 +231,9 @@ class Config bool bReport; bool bRespectUmask; bool bPlatformDetection; +#ifdef USE_QT_GUI_LOGIN + bool bDisableLoginGUI; +#endif // Cache bool bUseCache; diff --git a/main.cpp b/main.cpp index cd5faa5..fd41c5a 100644 --- a/main.cpp +++ b/main.cpp @@ -247,6 +247,9 @@ int main(int argc, char *argv[]) ("lowspeed-timeout", bpo::value(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted") ("lowspeed-rate", bpo::value(&Globals::globalConfig.curlConf.iLowSpeedTimeoutRate)->default_value(200), "Set average transfer speed in bytes per second that the transfer should be below during time specified with --lowspeed-timeout for it to be considered too slow and aborted") ("include-hidden-products", bpo::value(&Globals::globalConfig.bIncludeHiddenProducts)->zero_tokens()->default_value(false), "Include games that have been set hidden in account page") +#ifdef USE_QT_GUI_LOGIN + ("disable-login-gui", bpo::value(&Globals::globalConfig.bDisableLoginGUI)->zero_tokens()->default_value(false), "Disable login GUI when encountering reCAPTCHA on login form.\nUseful when downloader is compiled with GUI support but you are using it through SSH without X forwarding") +#endif ; // Options read from config file options_cfg_only.add_options() diff --git a/src/website.cpp b/src/website.cpp index c79759b..68d1daa 100644 --- a/src/website.cpp +++ b/src/website.cpp @@ -316,6 +316,12 @@ int Website::Login(const std::string& email, const std::string& password) << "Try to login later or compile LGOGDownloader with -DUSE_QT_GUI=ON" << std::endl; return res = 0; #else + if (Globals::globalConfig.bDisableLoginGUI) + { + std::cout << "Login form contains reCAPTCHA but GUI login is disabled." << std::endl + << "Enable GUI login or try to login later." << std::endl; + return res = 0; + } GuiLogin gl; gl.Login();