From 4dc8693216aca7a994c1098a70a396e415a51fb3 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Mon, 26 Aug 2019 13:33:24 +0200 Subject: [PATCH] updated change password layout & some other stuff --- .../ChangePasswordController.java | 13 ++++--- .../ui/controls/SecPasswordField.java | 1 - .../main/resources/fxml/changepassword.fxml | 34 ++++++++++--------- main/ui/src/main/resources/fxml/unlock2.fxml | 22 ++++++------ .../src/main/resources/fxml/vault_detail.fxml | 8 +++-- .../resources/fxml/vault_options_mount.fxml | 4 +-- .../main/resources/i18n/strings.properties | 7 ++-- 7 files changed, 51 insertions(+), 38 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/changepassword/ChangePasswordController.java b/main/ui/src/main/java/org/cryptomator/ui/changepassword/ChangePasswordController.java index e748a5ad8..0e65cc315 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/changepassword/ChangePasswordController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/changepassword/ChangePasswordController.java @@ -6,6 +6,7 @@ import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.layout.HBox; import javafx.scene.layout.Region; @@ -14,6 +15,7 @@ import javafx.stage.Stage; import org.cryptomator.common.vaults.Vault; import org.cryptomator.cryptolib.api.InvalidPassphraseException; import org.cryptomator.ui.common.FxController; +import org.cryptomator.ui.controls.FontAwesome5IconView; import org.cryptomator.ui.controls.SecPasswordField; import org.cryptomator.ui.util.PasswordStrengthUtil; import org.fxmisc.easybind.EasyBind; @@ -45,9 +47,10 @@ public class ChangePasswordController implements FxController { public Region passwordStrengthLevel4; public Label passwordStrengthLabel; public HBox passwordMatchBox; - public Rectangle checkmark; - public Rectangle cross; + public FontAwesome5IconView checkmark; + public FontAwesome5IconView cross; public Label passwordMatchLabel; + public CheckBox finalConfirmationCheckbox; public Button finishButton; @Inject @@ -67,12 +70,14 @@ public class ChangePasswordController implements FxController { BooleanBinding passwordsMatch = Bindings.createBooleanBinding(() -> CharSequence.compare(newPasswordField.getCharacters(), reenterPasswordField.getCharacters()) == 0, newPasswordField.textProperty(), reenterPasswordField.textProperty()); BooleanBinding reenterFieldNotEmpty = reenterPasswordField.textProperty().isNotEmpty(); //disable the finish button when passwords do not match or one is empty - finishButton.disableProperty().bind(reenterFieldNotEmpty.not().or(passwordsMatch.not())); + finishButton.disableProperty().bind(reenterFieldNotEmpty.not().or(passwordsMatch.not()).or(finalConfirmationCheckbox.selectedProperty().not())); //make match indicator invisible when passwords do not match or one is empty passwordMatchBox.visibleProperty().bind(reenterFieldNotEmpty); checkmark.visibleProperty().bind(passwordsMatch.and(reenterFieldNotEmpty)); + checkmark.managedProperty().bind(checkmark.visibleProperty()); cross.visibleProperty().bind(passwordsMatch.not().and(reenterFieldNotEmpty)); - passwordMatchLabel.textProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(resourceBundle.getString("addvaultwizard.new.passwordsMatch")).otherwise(resourceBundle.getString("addvaultwizard.new.passwordsDoNotMatch"))); + cross.managedProperty().bind(cross.visibleProperty()); + passwordMatchLabel.textProperty().bind(Bindings.when(passwordsMatch.and(reenterFieldNotEmpty)).then(resourceBundle.getString("changepassword.passwordsMatch")).otherwise(resourceBundle.getString("changepassword.passwordsDoNotMatch"))); //bindsings for the password strength indicator passwordStrengthLevel0.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(0), strengthRater::getBackgroundWithStrengthColor)); diff --git a/main/ui/src/main/java/org/cryptomator/ui/controls/SecPasswordField.java b/main/ui/src/main/java/org/cryptomator/ui/controls/SecPasswordField.java index 371dddf36..392800ca7 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controls/SecPasswordField.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controls/SecPasswordField.java @@ -69,7 +69,6 @@ public class SecPasswordField extends PasswordField { indicator.setTextFill(INDICATOR_COLOR); indicator.setFont(Font.font(indicator.getFont().getFamily(), 15.0)); this.getChildren().add(indicator); - this.setTooltip(tooltip); this.addEventHandler(DragEvent.DRAG_OVER, this::handleDragOver); this.addEventHandler(DragEvent.DRAG_DROPPED, this::handleDragDropped); this.addEventHandler(KeyEvent.ANY, this::handleKeyEvent); diff --git a/main/ui/src/main/resources/fxml/changepassword.fxml b/main/ui/src/main/resources/fxml/changepassword.fxml index 024c2330d..e112d8ca3 100644 --- a/main/ui/src/main/resources/fxml/changepassword.fxml +++ b/main/ui/src/main/resources/fxml/changepassword.fxml @@ -3,33 +3,34 @@ + - + - + - - + diff --git a/main/ui/src/main/resources/fxml/vault_detail.fxml b/main/ui/src/main/resources/fxml/vault_detail.fxml index da5cfd8e9..90882cf9f 100644 --- a/main/ui/src/main/resources/fxml/vault_detail.fxml +++ b/main/ui/src/main/resources/fxml/vault_detail.fxml @@ -71,8 +71,10 @@