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