From 4723416d45464744c877e52d6aaac7cefad602f6 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Fri, 21 Aug 2020 10:13:45 +0200 Subject: [PATCH] fixed icon views of labels in new password screen that could only appear once --- .../ui/common/NewPasswordController.java | 16 +++++++++------- .../ui/src/main/resources/fxml/new_password.fxml | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/common/NewPasswordController.java b/main/ui/src/main/java/org/cryptomator/ui/common/NewPasswordController.java index 24f3ac8db..19e33f7c3 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/common/NewPasswordController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/common/NewPasswordController.java @@ -24,10 +24,12 @@ public class NewPasswordController implements FxController { public NiceSecurePasswordField passwordField; public NiceSecurePasswordField reenterField; public Label passwordStrengthLabel; + public FontAwesome5IconView passwordStrengthCheckmark; + public FontAwesome5IconView passwordStrengthWarning; + public FontAwesome5IconView passwordStrengthCross; 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 password) { this.resourceBundle = resourceBundle; @@ -45,7 +47,7 @@ public class NewPasswordController implements FxController { BooleanBinding passwordsMatch = Bindings.createBooleanBinding(this::hasSamePasswordInBothFields, passwordField.textProperty(), reenterField.textProperty()); BooleanBinding reenterFieldNotEmpty = reenterField.textProperty().isNotEmpty(); 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"))); passwordField.textProperty().addListener(this::passwordsDidChange); @@ -56,11 +58,11 @@ public class NewPasswordController implements FxController { if (passwordField.getCharacters().length() == 0) { return null; } else if (passwordStrength.intValue() <= -1) { - return cross; + return passwordStrengthCross; } else if (passwordStrength.intValue() < 3) { - return warning; + return passwordStrengthWarning; } else { - return checkmark; + return passwordStrengthCheckmark; } } diff --git a/main/ui/src/main/resources/fxml/new_password.fxml b/main/ui/src/main/resources/fxml/new_password.fxml index 7593a1ccd..c406b8c70 100644 --- a/main/ui/src/main/resources/fxml/new_password.fxml +++ b/main/ui/src/main/resources/fxml/new_password.fxml @@ -12,9 +12,11 @@ spacing="6" alignment="CENTER_LEFT"> - - - + + + + +