static Pattern special = Pattern.compile("\\W");
private PasswordStrengthChecker() {
}
- public static int checkpwlight(String pw) {
+ private static int checkpwlight(String pw) {
int points = 0;
if (pw.length() > 15) {
points++;
return points;
}
public static int checkpw(String pw, User u) {
+ if (pw == null) {
+ return 0;
+ }
int light = checkpwlight(pw);
if (contained(pw, u.getEmail())) {
light -= 2;
return light;
}
private static boolean contained(String pw, String check) {
- if (check == null) {
+ if (check == null || check.equals("")) {
return false;
}
if (pw.contains(check)) {