started working on templates and api

This commit is contained in:
2022-04-15 14:59:51 +02:00
parent 26df2e5654
commit 546d3c10f3
16 changed files with 313 additions and 42 deletions

View File

@@ -62,4 +62,26 @@ public class Util {
public static boolean isEmail(String email) {
return email.matches(EMAIL_PATTERN);
}
public static boolean simplePassword(String pass) {
if (pass.length() < 6) return true;
if (pass.length() < 8){
for (int i=0; i<pass.length();i++){
if (!Character.isLetterOrDigit(pass.charAt(i))) return false; // password contains special character
}
}
if (pass.length() < 10){
var digit = false;
var letter = false;
for (int i=0; i<pass.length();i++){
char c = pass.charAt(i);
if (!Character.isLetterOrDigit(c)) return false; // password contains special character
digit |= Character.isDigit(c);
letter |= Character.isLetter(c);
if (letter && digit) return false; // password contains letters and digits
}
return true;
}
return false;
}
}