From ac37c5c15a3fd4f91f264800966da8e28f338c87 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Tue, 15 Sep 2009 15:54:55 -0700 Subject: [PATCH] Change Exchange username validation to exclude bare backslash * Fixes #2121422 Change-Id: Id55dfa365b83d725926e3e7dcd7b646256863aa1 --- .../activity/setup/AccountSetupExchange.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/com/android/email/activity/setup/AccountSetupExchange.java b/src/com/android/email/activity/setup/AccountSetupExchange.java index 2ed9a54ea..fcfbc8ff5 100644 --- a/src/com/android/email/activity/setup/AccountSetupExchange.java +++ b/src/com/android/email/activity/setup/AccountSetupExchange.java @@ -50,7 +50,7 @@ import java.net.URISyntaxException; * User (login) * Password */ -public class AccountSetupExchange extends Activity implements OnClickListener, +public class AccountSetupExchange extends Activity implements OnClickListener, OnCheckedChangeListener { private static final String EXTRA_ACCOUNT = "account"; private static final String EXTRA_MAKE_DEFAULT = "makeDefault"; @@ -88,7 +88,7 @@ public class AccountSetupExchange extends Activity implements OnClickListener, } /** - * For now, we'll simply replicate outgoing, for the purpose of satisfying the + * For now, we'll simply replicate outgoing, for the purpose of satisfying the * account settings flow. */ public static void actionEditOutgoingSettings(Activity fromActivity, Account account) @@ -174,7 +174,7 @@ public class AccountSetupExchange extends Activity implements OnClickListener, if (uri.getHost() != null) { mServerView.setText(uri.getHost()); } - + boolean ssl = uri.getScheme().contains("ssl"); mSslSecurityView.setChecked(ssl); mTrustCertificatesView.setChecked(uri.getScheme().contains("tssl")); @@ -196,6 +196,11 @@ public class AccountSetupExchange extends Activity implements OnClickListener, outState.putParcelable(EXTRA_ACCOUNT, mAccount); } + private boolean usernameFieldValid(EditText usernameView) { + return Utility.requiredFieldValid(usernameView) && + !usernameView.getText().toString().equals("\\"); + } + /** * Prepare a cached dialog with current values (e.g. account name) */ @@ -237,10 +242,10 @@ public class AccountSetupExchange extends Activity implements OnClickListener, /** * Check the values in the fields and decide if it makes sense to enable the "next" button - * NOTE: Does it make sense to extract & combine with similar code in AccountSetupIncoming? + * NOTE: Does it make sense to extract & combine with similar code in AccountSetupIncoming? */ private void validateFields() { - boolean enabled = Utility.requiredFieldValid(mUsernameView) + boolean enabled = usernameFieldValid(mUsernameView) && Utility.requiredFieldValid(mPasswordView) && Utility.requiredFieldValid(mServerView); if (enabled) { @@ -273,9 +278,9 @@ public class AccountSetupExchange extends Activity implements OnClickListener, } } } - + /** - * Attempt to create a URI from the fields provided. Throws URISyntaxException if there's + * Attempt to create a URI from the fields provided. Throws URISyntaxException if there's * a problem with the user input. * @return a URI built from the account setup fields */