diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-05 11:44:51 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-06-05 11:44:51 +0000 |
commit | 3e44b5f15948c9f9e1c99c59c51342b9447acc16 (patch) | |
tree | 825ed96e372522465f03f56c1b83863d23e1b54c /protocols/SkypeWeb | |
parent | ec68fa7fc31d82810cf3c216842430a2508d8f64 (diff) |
SkypeWeb: Fix login case sensitivity.
git-svn-id: http://svn.miranda-ng.org/main/trunk@14010 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/requests/login.h | 9 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 33 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 2 |
3 files changed, 39 insertions, 5 deletions
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h index f2adf9f5bf..ac513d2c66 100644 --- a/protocols/SkypeWeb/src/requests/login.h +++ b/protocols/SkypeWeb/src/requests/login.h @@ -24,7 +24,10 @@ public: LoginOAuthRequest(const char *username, const char *password) :
HttpRequest(REQUEST_POST, "api.skype.com/login/skypetoken")
{
- CMStringA str(::FORMAT, "%s\nskyper\n%s", username, password);
+ CMStringA user(username);
+ user.MakeLower();
+
+ CMStringA str(::FORMAT, "%s\nskyper\n%s", user, password);
BYTE digest[16];
@@ -34,8 +37,8 @@ public: Body
<< CHAR_VALUE("scopes", "client")
- << CHAR_VALUE("clientVersion", "0/7.4.85.102/259/")
- << CHAR_VALUE("username", ptrA(mir_urlEncode(username)))
+ << CHAR_VALUE("clientVersion", ptrA(mir_urlEncode("0/7.4.85.102/259/")))
+ << CHAR_VALUE("username", ptrA(mir_urlEncode(user.GetBuffer())))
<< CHAR_VALUE("passwordHash", ptrA(mir_urlEncode(hash)));
}
};
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 28131e1062..c68570f507 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -34,13 +34,44 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) return;
}
- if (response->resultCode != 200 || !json["skypetoken"] || !json["expiresIn"])
+ if (response->resultCode != 200)
{
+ if (!json["status"].isnull())
+ {
+ const JSONNode &status = json["status"];
+ if (!status["code"].isnull())
+ {
+ switch(status["code"].as_int())
+ {
+ case 40120:
+ {
+ ShowNotification(_T("Skype"), TranslateT("Authentication failed. Bad username or password."), NULL, 1);
+ break;
+ }
+ case 40121:
+ {
+ ShowNotification(_T("Skype"), TranslateT("Too many failed authentication attempts with given username or IP."), NULL, 1);
+ break;
+ }
+ default:
+ {
+ ShowNotification(_T("Skype"), !status["text"].isnull() ? status["text"].as_mstring().GetBuffer() : TranslateT("Authentication failed. Unknown error."), NULL, 1);
+ }
+ }
+ }
+ }
+
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
}
+ if (!json["skypetoken"] || !json["expiresIn"])
+ {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
std::string token = json["skypetoken"].as_string();
setString("TokenSecret", token.c_str());
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 66796c84c6..5971a6a49b 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -104,7 +104,7 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response, void *p) CMStringA data(response->pData);
int iStart = 0;
CMStringA szToken = data.Tokenize(":", iStart).Trim();
- TRouter.sessId = mir_strdup(szToken.GetBuffer());
+ TRouter.sessId = szToken.GetString();
m_hTrouterThread = ForkThreadEx(&CSkypeProto::TRouterThread, 0, NULL);
if (!isHealth)
|