|
|
@@ -1,12 +1,16 @@ |
|
|
|
public class PasswordChecker { |
|
|
|
public class PasswordChecker implements Validation{ |
|
|
|
|
|
|
|
private final static int pwMinLength = 6; |
|
|
|
private final int pwMinLength; |
|
|
|
|
|
|
|
public static boolean pwLength(String password){ |
|
|
|
public PasswordChecker(int minPwSize){ |
|
|
|
pwMinLength = minPwSize; |
|
|
|
} |
|
|
|
|
|
|
|
public boolean pwLength(String password){ |
|
|
|
return password.length() >= pwMinLength; |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean pwContainsNum(String password){ |
|
|
|
public boolean pwContainsNum(String password){ |
|
|
|
for (int i = 0; i < password.length(); i++) { |
|
|
|
if(Character.isDigit(password.charAt(i))){ |
|
|
|
return true; |
|
|
@@ -15,11 +19,11 @@ public class PasswordChecker { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private static boolean pwContainsSpecialHelper(char c){ |
|
|
|
private boolean pwContainsSpecialHelper(char c){ |
|
|
|
return(!(Character.isDigit(c)|| Character.isLetter(c))); |
|
|
|
} |
|
|
|
|
|
|
|
public static boolean pwContainsSpecial(String password){ |
|
|
|
public boolean pwContainsSpecial(String password){ |
|
|
|
for (int i = 0; i < password.length(); i++) { |
|
|
|
if(pwContainsSpecialHelper(password.charAt(i))){ |
|
|
|
return true; |