Offline username validation (avoid typing email when offline enabled)

This commit is contained in:
Duy Tran Khanh 2021-08-05 12:56:43 +07:00 committed by GitHub
parent fe515d5069
commit c37634ac69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -567,8 +567,8 @@ public class PojavLoginActivity extends BaseActivity
String text = edit2.getText().toString(); String text = edit2.getText().toString();
if (text.isEmpty()) { if (text.isEmpty()) {
edit2.setError(getString(R.string.global_error_field_empty)); edit2.setError(getString(R.string.global_error_field_empty));
} else if (text.length() <= 2) { } else if (text.length() < 3 || text.length() > 16 || !text.matches("\\w+")) {
edit2.setError(getString(R.string.login_error_short_username)); edit2.setError(getString(R.string.login_error_invalid_username));
} else if (new File(Tools.DIR_ACCOUNT_NEW + "/" + text + ".json").exists()) { } else if (new File(Tools.DIR_ACCOUNT_NEW + "/" + text + ".json").exists()) {
edit2.setError(getString(R.string.login_error_exist_username)); edit2.setError(getString(R.string.login_error_exist_username));
} else if (!edit3.getText().toString().isEmpty()) { } else if (!edit3.getText().toString().isEmpty()) {