Enforce minimum password length (amendment to #1018)

This commit is contained in:
Sebastian Stenzel
2019-12-18 15:31:52 +01:00
parent a2f3f5d254
commit ec800c5439
2 changed files with 5 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ public class NewPasswordController implements FxController {
}
private void passwordsDidChange(@SuppressWarnings("unused") Observable observable) {
if (hasSamePasswordInBothFields()) {
if (hasSamePasswordInBothFields() && strengthRater.fulfillsMinimumRequirements(passwordField.getCharacters())) {
password.set(passwordField.getCharacters());
} else {
password.set("");

View File

@@ -34,6 +34,10 @@ public class PasswordStrengthUtil {
this.zxcvbn = new Zxcvbn();
}
public boolean fulfillsMinimumRequirements(CharSequence password) {
return password.length() >= minPwLength;
}
public int computeRate(CharSequence password) {
if (password == null || password.length() < minPwLength) {
return -1;