|
@@ -24,10 +24,12 @@ public class NewPasswordController implements FxController {
|
|
public NiceSecurePasswordField passwordField;
|
|
public NiceSecurePasswordField passwordField;
|
|
public NiceSecurePasswordField reenterField;
|
|
public NiceSecurePasswordField reenterField;
|
|
public Label passwordStrengthLabel;
|
|
public Label passwordStrengthLabel;
|
|
|
|
+ public FontAwesome5IconView passwordStrengthCheckmark;
|
|
|
|
+ public FontAwesome5IconView passwordStrengthWarning;
|
|
|
|
+ public FontAwesome5IconView passwordStrengthCross;
|
|
public Label passwordMatchLabel;
|
|
public Label passwordMatchLabel;
|
|
- public FontAwesome5IconView checkmark;
|
|
|
|
- public FontAwesome5IconView warning;
|
|
|
|
- public FontAwesome5IconView cross;
|
|
|
|
|
|
+ public FontAwesome5IconView passwordMatchCheckmark;
|
|
|
|
+ public FontAwesome5IconView passwordMatchCross;
|
|
|
|
|
|
public NewPasswordController(ResourceBundle resourceBundle, PasswordStrengthUtil strengthRater, ObjectProperty<CharSequence> password) {
|
|
public NewPasswordController(ResourceBundle resourceBundle, PasswordStrengthUtil strengthRater, ObjectProperty<CharSequence> password) {
|
|
this.resourceBundle = resourceBundle;
|
|
this.resourceBundle = resourceBundle;
|
|
@@ -45,7 +47,7 @@ public class NewPasswordController implements FxController {
|
|
BooleanBinding passwordsMatch = Bindings.createBooleanBinding(this::hasSamePasswordInBothFields, passwordField.textProperty(), reenterField.textProperty());
|
|
BooleanBinding passwordsMatch = Bindings.createBooleanBinding(this::hasSamePasswordInBothFields, passwordField.textProperty(), reenterField.textProperty());
|
|
BooleanBinding reenterFieldNotEmpty = reenterField.textProperty().isNotEmpty();
|
|
BooleanBinding reenterFieldNotEmpty = reenterField.textProperty().isNotEmpty();
|
|
passwordMatchLabel.visibleProperty().bind(reenterFieldNotEmpty);
|
|
passwordMatchLabel.visibleProperty().bind(reenterFieldNotEmpty);
|
|
- passwordMatchLabel.graphicProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(checkmark).otherwise(cross));
|
|
|
|
|
|
+ passwordMatchLabel.graphicProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(passwordMatchCheckmark).otherwise(passwordMatchCross));
|
|
passwordMatchLabel.textProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(resourceBundle.getString("newPassword.passwordsMatch")).otherwise(resourceBundle.getString("newPassword.passwordsDoNotMatch")));
|
|
passwordMatchLabel.textProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(resourceBundle.getString("newPassword.passwordsMatch")).otherwise(resourceBundle.getString("newPassword.passwordsDoNotMatch")));
|
|
|
|
|
|
passwordField.textProperty().addListener(this::passwordsDidChange);
|
|
passwordField.textProperty().addListener(this::passwordsDidChange);
|
|
@@ -56,11 +58,11 @@ public class NewPasswordController implements FxController {
|
|
if (passwordField.getCharacters().length() == 0) {
|
|
if (passwordField.getCharacters().length() == 0) {
|
|
return null;
|
|
return null;
|
|
} else if (passwordStrength.intValue() <= -1) {
|
|
} else if (passwordStrength.intValue() <= -1) {
|
|
- return cross;
|
|
|
|
|
|
+ return passwordStrengthCross;
|
|
} else if (passwordStrength.intValue() < 3) {
|
|
} else if (passwordStrength.intValue() < 3) {
|
|
- return warning;
|
|
|
|
|
|
+ return passwordStrengthWarning;
|
|
} else {
|
|
} else {
|
|
- return checkmark;
|
|
|
|
|
|
+ return passwordStrengthCheckmark;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|