bug6104: adding zxcvbn-1.9.0 to target platform

This commit is contained in:
Axel Uhl
2025-03-24 17:19:28 +01:00
parent d65971ca35
commit 5ac6cba18a
5 changed files with 37 additions and 2 deletions
@@ -1079,7 +1079,7 @@ implements ReplicableSecurityService, ClearStateTestSupport {
}
if (username == null || username.length() < 3) {
throw new UserManagementException(UserManagementException.USERNAME_DOES_NOT_MEET_REQUIREMENTS);
} else if (password == null || password.length() < 5) {
} else if (isPasswordGoodEnough(password)) {
throw new UserManagementException(UserManagementException.PASSWORD_DOES_NOT_MEET_REQUIREMENTS);
}
RandomNumberGenerator rng = new SecureRandomNumberGenerator();
@@ -1098,6 +1098,10 @@ implements ReplicableSecurityService, ClearStateTestSupport {
updateSimpleUserEmail(username, email, validationBaseURL);
return result;
}
private boolean isPasswordGoodEnough(String password) {
return password == null || password.length() < 5;
}
/**
* Checks if the {@code clientIP} is currently blocked for user creation, and if so, throws a
@@ -1183,7 +1187,7 @@ implements ReplicableSecurityService, ClearStateTestSupport {
}
private void updateSimpleUserPassword(final User user, String newPassword) throws UserManagementException {
if (newPassword == null || newPassword.length() < 5) {
if (isPasswordGoodEnough(newPassword)) {
throw new UserManagementException(UserManagementException.PASSWORD_DOES_NOT_MEET_REQUIREMENTS);
}
// for non-admins, check that the old password is correct