diff options
author | Fup Duck <fupduck@sacknagel.com> | 2018-02-25 10:01:57 +0100 |
---|---|---|
committer | Fup Duck <fupduck@sacknagel.com> | 2018-02-25 10:01:57 +0100 |
commit | 98d58aaa50ed5bf5bb6789740b3dfa40b6879724 (patch) | |
tree | 9bfd37e6b2b0763fa686cbf076c4fc39ce2e6e2a | |
parent | 0f5a0510aa83872417467914ad52aa3d0d663f51 (diff) | |
parent | 241b1c4491d2534bb0f79af21ba180b9b3d99446 (diff) |
Merge branch '0xacab_0.9.8' into 8865_cancel_without_internet
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java index e6877756..15cd9617 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java @@ -186,7 +186,11 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc String username = usernameField.getText().toString(); String providerDomain = provider.getDomain(); if (username.endsWith(providerDomain)) { - return username.split("@" + providerDomain)[0]; + try { + return username.split("@" + providerDomain)[0]; + } catch (ArrayIndexOutOfBoundsException e) { + return ""; + } } return username; } @@ -240,9 +244,15 @@ public abstract class ProviderCredentialsBaseActivity extends ConfigWizardBaseAc @Override public void afterTextChanged(Editable s) { if (getUsername().equalsIgnoreCase("")) { + s.clear(); usernameError.setError(getString(R.string.username_ask)); } else { usernameError.setError(null); + String suffix = "@" + provider.getDomain(); + if (!usernameField.getText().toString().endsWith(suffix)) { + s.append(suffix); + usernameField.setSelection(usernameField.getText().toString().indexOf('@')); + } } } }); |