diff options
author | Robert Pösel <robyer@seznam.cz> | 2016-03-27 00:19:03 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2016-03-27 00:19:03 +0000 |
commit | 3e19b9ac8c27d804c5103be23bc9c476c2884948 (patch) | |
tree | 9cb0273cf8b94144ed49d98e6b140d3141dcf576 | |
parent | b40bfa3a816268de244ae2f2e6c0a4a8818e88b8 (diff) |
Facebook: Improve login procedure
Tries to automatically delete DeviceID and login again once. Maybe also fixes notification that someone logged in from unknown device.
git-svn-id: http://svn.miranda-ng.org/main/trunk@16551 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 20 | ||||
-rw-r--r-- | protocols/FacebookRM/src/db.h | 5 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 1 |
3 files changed, 21 insertions, 5 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index b4abb94c6a..122fd615b0 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -801,6 +801,8 @@ bool facebook_client::login(const char *username, const char *password) get_data += "&" + utils::text::source_get_value(&form, 2, "login.php?login_attempt=1&", "\""); } + data += "&lgndim=eyJ3IjoxOTIwLCJoIjoxMDgwLCJhdyI6MTgzNCwiYWgiOjEwODAsImMiOjMyfQ=="; // means base64 encoded: {"w":1920,"h":1080,"aw":1834,"ah":1080,"c":32} + // Send validation http::response resp = flap(REQUEST_LOGIN, &data, &get_data); @@ -889,10 +891,20 @@ bool facebook_client::login(const char *username, const char *password) resp = flap(REQUEST_SETUP_MACHINE, &inner_data); } else if (resp.data.find("name=\"submit[Get Started]\"") != std::string::npos) { - // Facebook things that computer was infected by malware and needs cleaning - client_notify(TranslateT("Login error: Facebook thinks your computer is infected. Solve it by logging in via 'private browsing' mode of your web browser and run their antivirus check.")); - parent->debugLogA("!!! Login error: Facebook requires computer scan."); - return handle_error("login", FORCE_QUIT); + if (!parent->getBool(FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID)) { + // Try to remove DeviceID and login again + cookies["datr"] = ""; + parent->delSetting(FACEBOOK_KEY_DEVICE_ID); + parent->setByte(FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID, 1); + return login(username, password); + } else { + // Reset flag + parent->delSetting(FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID); + // Facebook things that computer was infected by malware and needs cleaning + client_notify(TranslateT("Login error: Facebook thinks your computer is infected. Solve it by logging in via 'private browsing' mode of your web browser and run their antivirus check.")); + parent->debugLogA("!!! Login error: Facebook requires computer scan."); + return handle_error("login", FORCE_QUIT); + } } } } diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h index 93873e0783..1c475c8237 100644 --- a/protocols/FacebookRM/src/db.h +++ b/protocols/FacebookRM/src/db.h @@ -86,4 +86,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode"
#define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with
#define FACEBOOK_KEY_SEND_MESSAGE_TRIES "SendMessageTries" // [HIDDEN] - (byte) = number of tries to send message, default=1, min=1, max=5
-#define FACEBOOK_KEY_FETCH_MOBILE "FetchMobile" // [HIDDEN] - (byte) 0 = don't fetch mobile contacts (default), 1 = fetch mobile classicaly
\ No newline at end of file +#define FACEBOOK_KEY_FETCH_MOBILE "FetchMobile" // [HIDDEN] - (byte) 0 = don't fetch mobile contacts (default), 1 = fetch mobile classicaly
+
+// Temporary key for login
+#define FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID "_TriedDeletingDeviceID"
\ No newline at end of file diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 7501fe117e..85f25595a4 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -72,6 +72,7 @@ FacebookProto::FacebookProto(const char* proto_name, const TCHAR* username) : db_set_resident(m_szModuleName, "IdleTS"); db_set_resident(m_szModuleName, FACEBOOK_KEY_MESSAGE_READ); db_set_resident(m_szModuleName, FACEBOOK_KEY_MESSAGE_READERS); + db_set_resident(m_szModuleName, FACEBOOK_KEY_TRIED_DELETING_DEVICE_ID); InitHotkeys(); InitPopups(); |