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,6 +119,7 @@ public class LoginActivity extends AppCompatActivity {
connectionButton = findViewById(R.id.login_button); connectionButton = findViewById(R.id.login_button);
if (!BuildConfig.full_instances) {
login_uid.setOnFocusChangeListener((v, hasFocus) -> { login_uid.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) { if (!hasFocus) {
if (android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) { if (android.util.Patterns.EMAIL_ADDRESS.matcher(login_uid.getText().toString().trim()).matches()) {
@ -129,11 +130,12 @@ public class LoginActivity extends AppCompatActivity {
} }
} }
}); });
}
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;
} }