Pwcheckerclass
This commit is contained in:
parent
93842c6bfb
commit
169543139f
@ -1,2 +1,30 @@
|
|||||||
public class PasswordChecker {
|
public class PasswordChecker {
|
||||||
|
|
||||||
|
private final static int pwMinLength = 6;
|
||||||
|
|
||||||
|
public static boolean pwLength(String password){
|
||||||
|
return password.length() >= pwMinLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean pwContainsNum(String password){
|
||||||
|
for (int i = 0; i < password.length(); i++) {
|
||||||
|
if(Character.isDigit(password.charAt(i))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean pwContainsSpecialHelper(char c){
|
||||||
|
return(!(Character.isDigit(c)|| Character.isLetter(c)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean pwContainsSpecial(String password){
|
||||||
|
for (int i = 0; i < password.length(); i++) {
|
||||||
|
if(pwContainsSpecialHelper(password.charAt(i))){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user