Update login validation

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-03 16:15:55 +01:00
parent 8553b934a6
commit 64256d2d67
4 changed files with 7 additions and 15 deletions

View File

@ -114,10 +114,6 @@ public class LoginActivity extends AppCompatActivity {
mPasswordView.setError(getString(R.string.error_field_required));
focusView = mPasswordView;
cancel = true;
} else if (!isPasswordValid(password)) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
}
if (cancel) {
@ -130,13 +126,9 @@ public class LoginActivity extends AppCompatActivity {
}
private boolean isEmailValid(String loginName) {
Pattern pattern = Pattern.compile("^s\\d+");
Pattern pattern = Pattern.compile("\\s");
Matcher matcher = pattern.matcher(loginName);
return matcher.find();
}
private boolean isPasswordValid(String password) {
return password.length() > 4;
return !matcher.find();
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)

View File

@ -121,7 +121,7 @@ public class PrefUtils {
}
public static String getLocale(Context context) {
return getSharedPreferences(context).getString("LOCALE", null);
return getSharedPreferences(context).getString("LOCALE", "pl");
}

View File

@ -111,13 +111,12 @@
<string name="userNote"><b>Notatka</b></string>
<string name="userDutyHoursHeader"><b>Dyżury</b></string>
<string name="dutyHours"> <b>Dyżury</b></string>
<string name="error_invalid_login_name">Niepoprawny format loginu.</string>
<string name="userDepartment">Zakład</string>
<string name="loading">Loading …</string>
<string name="logo_find_my_tutor">Logo find my tutor</string>
<string name="prompt_login">Login (Ldap)</string>
<string name="action_log_in">Zaloguj!</string>
<string name="error_invalid_login_name">Niepoprawny format loginu.</string>
<string name="user_list_nav">Lista użytkowników</string>
</resources>

View File

@ -170,12 +170,13 @@
<string name="userNote"><b>Note</b></string>
<string name="userDutyHoursHeader"><b>Duty Hours</b></string>
<string name="dutyHours"> <b>Duty Hours</b></string>
<string name="error_invalid_login_name">Invalid format login. Use s11111 format</string>
<string name="userDepartment">Department</string>
<string name="loading">Loading …</string>
<string name="logo_find_my_tutor">Logo find my tutor</string>
<string name="prompt_login">Login (sXXXXXX)</string>
<string name="prompt_login">Login (Ldap)</string>
<string name="action_log_in">Log in </string>
<string name="user_list_nav">Users list</string>
<string name="error_invalid_login_name">Invalid login format.</string>
</resources>