From 5978db9bf758b7b229616d0575e327c58ad8cf94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 9 Dec 2014 14:08:17 +0100 Subject: EIP fragment shown correctly. --- .../debug/java/se/leap/bitmaskclient/ProviderAPI.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index a89ef357..52a424f4 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -32,7 +32,6 @@ import org.apache.http.client.ClientProtocolException; import org.json.*; import se.leap.bitmaskclient.ProviderListContent.ProviderItem; -import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.*; /** @@ -59,11 +58,10 @@ public class ProviderAPI extends IntentService { ERRORS = "errors", UPDATE_PROGRESSBAR = "update_progressbar", CURRENT_PROGRESS = "current_progress", - TAG = ProviderAPI.class.getSimpleName(); + TAG = ProviderAPI.class.getSimpleName() ; final public static int - CUSTOM_PROVIDER_ADDED = 0, SRP_AUTHENTICATION_SUCCESSFUL = 3, SRP_AUTHENTICATION_FAILED = 4, SRP_REGISTRATION_SUCCESSFUL = 5, @@ -73,9 +71,7 @@ public class ProviderAPI extends IntentService { CORRECTLY_DOWNLOADED_CERTIFICATE = 9, INCORRECTLY_DOWNLOADED_CERTIFICATE = 10, PROVIDER_OK = 11, - PROVIDER_NOK = 12, - CORRECTLY_DOWNLOADED_ANON_CERTIFICATE = 13, - INCORRECTLY_DOWNLOADED_ANON_CERTIFICATE = 14 + PROVIDER_NOK = 12 ; private static boolean @@ -128,11 +124,11 @@ public class ProviderAPI extends IntentService { try { JSONObject provider_json = new JSONObject(preferences.getString(Provider.KEY, "no provider")); provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); + setting_up_provider = true; } catch (JSONException e) { + setting_up_provider = false; } } - - setting_up_provider = true; if(action.equalsIgnoreCase(SET_UP_PROVIDER)) { Bundle result = setUpProvider(parameters); @@ -370,7 +366,7 @@ public class ProviderAPI extends IntentService { * Sends an HTTP POST request to the api server to register a new user. * @param server_url * @param username - * @param salted_password + * @param salt * @param password_verifier * @return response from authentication server */ @@ -491,6 +487,7 @@ public class ProviderAPI extends IntentService { last_danger_on = task.getBoolean(ProviderItem.DANGER_ON); last_provider_main_url = task.getString(Provider.MAIN_URL); CA_CERT_DOWNLOADED = PROVIDER_JSON_DOWNLOADED = EIP_SERVICE_JSON_DOWNLOADED = false; + setting_up_provider = true; } if(!PROVIDER_JSON_DOWNLOADED) @@ -694,7 +691,7 @@ public class ProviderAPI extends IntentService { /** * Tries to download the contents of the provided url using not commercially validated CA certificate from chosen provider. - * @param url as a string + * @param url_string as a string * @param danger_on true to download CA certificate in case it has not been downloaded. * @return an empty string if it fails, the url content if not. */ @@ -818,7 +815,6 @@ public class ProviderAPI extends IntentService { /** * Logs out from the api url retrieved from the task. - * @param task containing api url from which the user will log out * @return true if there were no exceptions */ private boolean logOut() { -- cgit v1.2.3 From 062e4c4597f947816282b1c9c5e63c034549f057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Tue, 9 Dec 2014 18:57:35 +0100 Subject: Final refactoring for this bug. Removed the sign up dialog, log in one is enough with the third button I added some time ago to sign up. Removed classes we don't need due to the libraries I have recently introduced. --- .../java/se/leap/bitmaskclient/ProviderAPI.java | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java') diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java index 52a424f4..9ac5ff66 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -172,8 +172,8 @@ public class ProviderAPI extends IntentService { Bundle session_id_bundle = new Bundle(); int progress = 0; - String username = (String) task.get(SessionDialogInterface.USERNAME); - String password = (String) task.get(SessionDialogInterface.PASSWORD); + String username = (String) task.get(SessionDialog.USERNAME); + String password = (String) task.get(SessionDialog.PASSWORD); if(validUserLoginData(username, password)) { session_id_bundle = register(username, password); @@ -181,12 +181,12 @@ public class ProviderAPI extends IntentService { } else { if(!wellFormedPassword(password)) { session_id_bundle.putBoolean(RESULT_KEY, false); - session_id_bundle.putString(SessionDialogInterface.USERNAME, username); - session_id_bundle.putBoolean(SessionDialogInterface.PASSWORD_INVALID_LENGTH, true); + session_id_bundle.putString(SessionDialog.USERNAME, username); + session_id_bundle.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true); } if(username.isEmpty()) { session_id_bundle.putBoolean(RESULT_KEY, false); - session_id_bundle.putBoolean(SessionDialogInterface.USERNAME_MISSING, true); + session_id_bundle.putBoolean(SessionDialog.USERNAME_MISSING, true); } } @@ -205,8 +205,8 @@ public class ProviderAPI extends IntentService { if(api_result.has(ERRORS)) result = authFailedNotification(api_result, username); else { - result.putString(SessionDialogInterface.USERNAME, username); - result.putString(SessionDialogInterface.PASSWORD, password); + result.putString(SessionDialog.USERNAME, username); + result.putString(SessionDialog.PASSWORD, password); result.putBoolean(RESULT_KEY, true); } @@ -222,20 +222,20 @@ public class ProviderAPI extends IntentService { Bundle result = new Bundle(); int progress = 0; - String username = (String) task.get(SessionDialogInterface.USERNAME); - String password = (String) task.get(SessionDialogInterface.PASSWORD); + String username = (String) task.get(SessionDialog.USERNAME); + String password = (String) task.get(SessionDialog.PASSWORD); if(validUserLoginData(username, password)) { result = authenticate(username, password); broadcast_progress(progress++); } else { if(!wellFormedPassword(password)) { result.putBoolean(RESULT_KEY, false); - result.putString(SessionDialogInterface.USERNAME, username); - result.putBoolean(SessionDialogInterface.PASSWORD_INVALID_LENGTH, true); + result.putString(SessionDialog.USERNAME, username); + result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true); } if(username.isEmpty()) { result.putBoolean(RESULT_KEY, false); - result.putBoolean(SessionDialogInterface.USERNAME_MISSING, true); + result.putBoolean(SessionDialog.USERNAME_MISSING, true); } } @@ -265,7 +265,7 @@ public class ProviderAPI extends IntentService { } } else { result.putBoolean(RESULT_KEY, false); - result.putString(SessionDialogInterface.USERNAME, username); + result.putString(SessionDialog.USERNAME, username); result.putString(getResources().getString(R.string.user_message), getResources().getString(R.string.error_srp_math_error_user_message)); } } catch (JSONException e) { @@ -296,7 +296,7 @@ public class ProviderAPI extends IntentService { } catch(JSONException e) {} if(!username.isEmpty()) - user_notification_bundle.putString(SessionDialogInterface.USERNAME, username); + user_notification_bundle.putString(SessionDialog.USERNAME, username); user_notification_bundle.putBoolean(RESULT_KEY, false); return user_notification_bundle; -- cgit v1.2.3