You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
909 B
33 lines
909 B
package Base;
|
|
|
|
public class User {
|
|
private String email;
|
|
private String password;
|
|
|
|
|
|
public User(String email) {
|
|
this.email = email;
|
|
}
|
|
|
|
public String get_email() { return email; }
|
|
public String get_password() { return password; }
|
|
public void set_password(String password) { this.password = password; }
|
|
|
|
public static boolean check_password(String password) {
|
|
if (password == null || password.length() < 6 || password.length() > 20) {
|
|
return false;
|
|
}
|
|
|
|
boolean hasUpper = false;
|
|
boolean hasLower = false;
|
|
boolean hasDigit = false;
|
|
|
|
for (char c : password.toCharArray()) {
|
|
if (Character.isUpperCase(c)) hasUpper = true;
|
|
if (Character.isLowerCase(c)) hasLower = true;
|
|
if (Character.isDigit(c)) hasDigit = true;
|
|
}
|
|
return hasUpper && hasLower && hasDigit;
|
|
}
|
|
}
|