summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient
diff options
context:
space:
mode:
authorFup Duck <fupduck@sacknagel.com>2018-02-22 15:47:32 +0100
committerFup Duck <fupduck@sacknagel.com>2018-02-22 15:47:32 +0100
commit0cf6368a993d23527802b3eba70ddeda4b5933c6 (patch)
tree09cb9af7026e4a10a783c032bbe0028572ebbbf6 /app/src/main/java/se/leap/bitmaskclient
parentaf3ac0476f2b6320cd3e3ff8e17453d50bbace08 (diff)
8867 - add url to username
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/ProviderCredentialsBaseActivity.java12
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('@'));
+ }
}
}
});