diff options
author | Robert Pösel <robyer@seznam.cz> | 2017-05-05 23:01:45 +0200 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2017-05-05 23:01:45 +0200 |
commit | d222d890c51ea95aab36c091a3d9ca18f5698afc (patch) | |
tree | 06cdb61ef513dd07f27cf545bcbfbd1452e8ab04 /protocols | |
parent | 53822bf2212065240cc716b3250f0e85f60af4b3 (diff) |
Facebook: Fix not remembering login
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index fb2447e8c1..712c5daaf6 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -448,9 +448,8 @@ bool facebook_client::login(const char *username, const char *password) LoginRequest *request = new LoginRequest(); http::response resp = sendRequest(request); - // Also parse cookies set by JavaScript (more variant exists in time, so check all known now) - parseJsCookies("[\"DeferredCookie\",\"addToQueue\",[],[\"", resp.data, cookies); - parseJsCookies("[\"Cookie\",\"setIfFirstPartyContext\",[],[\"", resp.data, cookies); + // Also parse cookies set by JavaScript + parseJsCookies("[\"CookieCore\",\"setWithoutChecksIfFirstPartyContext\",[],[\"", resp.data, cookies); // Parse hidden inputs and other data std::string form = utils::text::source_get_value(&resp.data, 2, "<form", "</form>"); @@ -528,10 +527,21 @@ bool facebook_client::login(const char *username, const char *password) break; } } - + + // Save this actual device + if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos + && resp.data.find("name=\"name_action_selected\"") != std::string::npos) { + std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); + std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); + + request = new SetupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue"); + request->Body << "&name_action_selected=save_device"; // Save device - or "dont_save" + resp = sendRequest(request); + } + // Check if we need to approve also last unapproved device - // 1) Continue (it might have been sent with approval code above already) + // 1) Continue to check last unknown login if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos) { std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); @@ -539,7 +549,7 @@ bool facebook_client::login(const char *username, const char *password) request = new SetupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue"); resp = sendRequest(request); } - + // In this step might be needed identity confirmation if (resp.data.find("name=\"birthday_captcha_") != std::string::npos) { // Account is locked and needs identity confirmation @@ -580,16 +590,6 @@ bool facebook_client::login(const char *username, const char *password) request->Body << "&name_action_selected=save_device"; // Save device - or "dont_save" resp = sendRequest(request); } - - // Save this actual device - if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos) { - std::string fb_dtsg = utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"")); - std::string nh = utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\""); - - request = new SetupMachineRequest(fb_dtsg.c_str(), nh.c_str(), "Continue"); - request->Body << "&name_action_selected=save_device"; // Save device - or "dont_save" - resp = sendRequest(request); - } } else if (resp.data.find("name=\"submit[Get Started]\"") != std::string::npos) { if (!parent->getBool(FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID)) { |