From 7d046fda66e8933b509b854077b7acfb3b3b7c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Mon, 26 Jan 2015 14:18:56 +0100 Subject: Don't reuse last session dialog. It was giving problems when trying to change the arguments. --- .../java/se/leap/bitmaskclient/ProviderAPI.java | 22 +++++++++++----------- 1 file changed, 11 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 1dbe11d3..0650f0ad 100644 --- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java @@ -179,28 +179,28 @@ public class ProviderAPI extends IntentService { } private Bundle tryToRegister(Bundle task) { - Bundle session_id_bundle = new Bundle(); + Bundle result = new Bundle(); int progress = 0; - String username = (String) task.get(SessionDialog.USERNAME); - String password = (String) task.get(SessionDialog.PASSWORD); + String username = task.getString(SessionDialog.USERNAME); + String password = task.getString(SessionDialog.PASSWORD); if(validUserLoginData(username, password)) { - session_id_bundle = register(username, password); + result = register(username, password); broadcastProgress(progress++); } else { if(!wellFormedPassword(password)) { - session_id_bundle.putBoolean(RESULT_KEY, false); - session_id_bundle.putString(SessionDialog.USERNAME, username); - session_id_bundle.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true); + result.putBoolean(RESULT_KEY, false); + result.putString(SessionDialog.USERNAME, username); + result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true); } - if(username.isEmpty()) { - session_id_bundle.putBoolean(RESULT_KEY, false); - session_id_bundle.putBoolean(SessionDialog.USERNAME_MISSING, true); + if(!validUsername(username)) { + result.putBoolean(RESULT_KEY, false); + result.putBoolean(SessionDialog.USERNAME_MISSING, true); } } - return session_id_bundle; + return result; } private Bundle register(String username, String password) { -- cgit v1.2.3