diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-10-09 14:32:01 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-10-09 14:32:01 +0000 |
commit | 30eda997b099947ea38c17d547950edc4a5af8eb (patch) | |
tree | 408bb03b2eaacf0c301d4a446b44dade5d460cb8 /protocols/FacebookRM | |
parent | 4ac61b9298b23a8e024a585cddd47b7d4e8f6104 (diff) |
Facebook: Fix for remembering device (no more e-mail notification on every login)
git-svn-id: http://svn.miranda-ng.org/main/trunk@6416 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 6e908c5505..f97c6f6c70 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -346,7 +346,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string return "/login.php?login_attempt=1";
case REQUEST_SETUP_MACHINE:
- return "/checkpoint/";
+ return "/checkpoint/?next";
case REQUEST_LOGOUT:
return "/logout.php";
@@ -685,7 +685,7 @@ bool facebook_client::login(const char *username, const char *password) }
// Prepare login data
- std::string data = "charset_test=%e2%82%ac%2c%c2%b4%2c%e2%82%ac%2c%c2%b4%2c%e6%b0%b4%2c%d0%94%2c%d0%84&pass_placeHolder=Password&login=Login&persistent=1";
+ std::string data = "persistent=1";
data += "&email=" + utils::url::encode(username);
data += "&pass=" + utils::url::encode(password);
@@ -730,21 +730,31 @@ bool facebook_client::login(const char *username, const char *password) std::string inner_data;
if (resp.data.find("name=\"submit[Continue]\"") != std::string::npos) {
- // Multi step with approving last unrecognized device
- // 1) Continue
- inner_data = "submit[Continue]=Continue";
- inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
- inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
- resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
-
- // 2) Approve last unknown login
- // inner_data = "submit[I%20don't%20recognize]=I%20don't%20recognize"; // Don't recognize - this will force to change account password
- inner_data = "submit[This%20is%20Okay]=This%20is%20Okay"; // Recognize
- inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
- inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
- resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+
+ // Check if we need to approve also last unapproved device
+ if (resp.data.find("name=\"name_action_selected\"") == std::string::npos) {
+ // 1) Continue
+ inner_data = "submit[Continue]=Continue";
+ inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
+ inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
+ resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+
+ // 2) Approve last unknown login
+ // inner_data = "submit[I%20don't%20recognize]=I%20don't%20recognize"; // Don't recognize - this will force to change account password
+ inner_data = "submit[This%20is%20Okay]=This%20is%20Okay"; // Recognize
+ inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
+ inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
+ resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+
+ // 3) Save last device
+ inner_data = "submit[Continue]=Continue";
+ inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
+ inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
+ inner_data += "&name_action_selected=save_device"; // Save device - or "dont_save"
+ resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+ }
- // 3) Save device
+ // Save this actual device
inner_data = "submit[Continue]=Continue";
inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
inner_data += "&fb_dtsg=" + utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
|