summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-07-10 21:42:42 +0200
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-12 15:00:19 -0600
commita8d10d9800fcd58d8ee5e3b428b8ba402e83764f (patch)
treea5436075d523e15bf2ee6af0cfdb74676feaa89c /src/se/leap/leapclient
parent1d1b3a18da29a17ffb983aa5439659970fe0ab83 (diff)
Shows bad user/password message when appropriate.
If an empty json string is received after sending M1 (that means no M2 in return), bad user/password message is shown. This fixes bug 3153.
Diffstat (limited to 'src/se/leap/leapclient')
-rw-r--r--src/se/leap/leapclient/ProviderAPI.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/se/leap/leapclient/ProviderAPI.java b/src/se/leap/leapclient/ProviderAPI.java
index 25a14bb..37856f6 100644
--- a/src/se/leap/leapclient/ProviderAPI.java
+++ b/src/se/leap/leapclient/ProviderAPI.java
@@ -192,12 +192,13 @@ public class ProviderAPI extends IntentService {
byte[] Bbytes = new BigInteger(saltAndB.getString("B"), 16).toByteArray();
byte[] M1 = client.response(new BigInteger(salt, 16).toByteArray(), Bbytes);
JSONObject session_idAndM2 = sendM1ToSRPServer(authentication_server, username, M1);
- if( client.verify((byte[])session_idAndM2.get("M2")) == false ) {
- session_id_bundle.putBoolean(ConfigHelper.RESULT_KEY, false);
- } else {
+ if(session_idAndM2.has("M2") && client.verify((byte[])session_idAndM2.get("M2"))) {
session_id_bundle.putBoolean(ConfigHelper.RESULT_KEY, true);
session_id_bundle.putString(ConfigHelper.SESSION_ID_KEY, session_idAndM2.getString(ConfigHelper.SESSION_ID_KEY));
session_id_bundle.putString(ConfigHelper.SESSION_ID_COOKIE_KEY, session_idAndM2.getString(ConfigHelper.SESSION_ID_COOKIE_KEY));
+ } else {
+ session_id_bundle.putBoolean(ConfigHelper.RESULT_KEY, false);
+ session_id_bundle.putString(getResources().getString(R.string.user_message), getResources().getString(R.string.error_bad_user_password_user_message));
}
} else {
session_id_bundle.putString(getResources().getString(R.string.user_message), getResources().getString(R.string.error_bad_user_password_user_message));