allows username when logging in

This commit is contained in:
Thomas 2020-09-19 13:01:27 +02:00
parent aaa8281da8
commit 13baaccd81
1 changed files with 11 additions and 9 deletions

View File

@ -119,21 +119,23 @@ public class LoginActivity extends AppCompatActivity {
connectionButton = findViewById(R.id.login_button);
login_uid.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
if (android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) {
String[] emailArray = login_uid.getText().toString().split("@");
if (emailArray.length > 1 && Arrays.asList(Helper.openid).contains(emailArray[1])) {
connectionButton.callOnClick();
if (!BuildConfig.full_instances) {
login_uid.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
if (android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) {
String[] emailArray = login_uid.getText().toString().split("@");
if (emailArray.length > 1 && Arrays.asList(Helper.openid).contains(emailArray[1])) {
connectionButton.callOnClick();
}
}
}
}
});
});
}
connectionButton.setOnClickListener(v -> {
if (!android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) {
if (login_uid.getText().toString().contains("@") && !android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) {
Toasty.error(LoginActivity.this, getString(R.string.email_error)).show();
return;
}