Prechádzať zdrojové kódy

updated change password layout & some other stuff

Tobias Hagemann 5 rokov pred
rodič
commit
4dc8693216

+ 9 - 4
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));

+ 0 - 1
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);

+ 18 - 16
main/ui/src/main/resources/fxml/changepassword.fxml

@@ -3,33 +3,34 @@
 <?import javafx.geometry.Insets?>
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.ButtonBar?>
+<?import javafx.scene.control.CheckBox?>
 <?import javafx.scene.control.Label?>
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.Region?>
 <?import javafx.scene.layout.VBox?>
-<?import javafx.scene.shape.Rectangle?>
 <?import javafx.scene.text.Text?>
 <?import javafx.scene.text.TextFlow?>
+<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
 <?import org.cryptomator.ui.controls.SecPasswordField?>
 <VBox xmlns="http://javafx.com/javafx"
 	  xmlns:fx="http://javafx.com/fxml"
 	  fx:controller="org.cryptomator.ui.changepassword.ChangePasswordController"
 	  minWidth="300"
-	  maxWidth="600"
+	  maxWidth="300"
 	  spacing="6">
 	<padding>
-		<Insets bottom="6.0" left="6.0" right="6.0" top="6.0"/>
+		<Insets bottom="12.0" left="12.0" right="12.0" top="12.0"/>
 	</padding>
 	<children>
 		<TextFlow styleClass="text-flow">
-			<Label labelFor="$oldPasswordField" text="%changepassword.enterOldPassword"/>
+			<Text text="%changepassword.enterOldPassword"/>
 			<Text text=" &quot;"/>
 			<Text text="${controller.vault.displayableName}"/>
 			<Text text="&quot;:"/>
 		</TextFlow>
 		<SecPasswordField fx:id="oldPasswordField"/>
 
-		<Region VBox.vgrow="ALWAYS" minHeight="48"/>
+		<Region prefHeight="36" VBox.vgrow="NEVER"/>
 
 		<Label labelFor="$newPasswordField" text="%changepassword.enterNewPassword"/>
 		<SecPasswordField fx:id="newPasswordField"/>
@@ -41,25 +42,26 @@
 			<Region HBox.hgrow="ALWAYS" fx:id="passwordStrengthLevel4" cacheShape="true" cache="true"/>
 		</HBox>
 		<HBox alignment="BASELINE_RIGHT">
-			<Label fx:id="passwordStrengthLabel"/>
+			<Label fx:id="passwordStrengthLabel" styleClass="label-secondary"/>
 		</HBox>
 
-		<Region VBox.vgrow="ALWAYS" minHeight="12"/>
+		<Region VBox.vgrow="NEVER"/>
 
 		<Label labelFor="$reenterPasswordField" text="%changepassword.reenterNewPassword"/>
 		<SecPasswordField fx:id="reenterPasswordField"/>
-		<HBox fx:id="passwordMatchBox" spacing="12.0" alignment="BASELINE_RIGHT">
-			<!-- TODO
-			<ImageView fx:id="checkmark" image="/path/to/checkmark" fitWidth="10" fitHeight="10" />
-			<ImageView fx:id="cross" image="/path/to/cross" fitWidth="10" fitHeight="10" />
-			-->
-			<Rectangle fx:id="checkmark" width="10" height="10" fill="green"/>
-			<Rectangle fx:id="cross" width="10" height="10" fill="red"/>
-			<Label fx:id="passwordMatchLabel"/>
+		<HBox fx:id="passwordMatchBox" spacing="6" alignment="BASELINE_RIGHT">
+			<FontAwesome5IconView fx:id="checkmark" styleClass="glyph-icon-secondary" glyph="CHECK"/>
+			<FontAwesome5IconView fx:id="cross" styleClass="glyph-icon-secondary" glyph="TIMES"/>
+			<Label fx:id="passwordMatchLabel" styleClass="label-secondary" labelFor="$reenterPasswordField"/>
 		</HBox>
 
+		<Region prefHeight="12" VBox.vgrow="NEVER"/>
+
+		<CheckBox fx:id="finalConfirmationCheckbox" text="%changepassword.finalConfirmation" wrapText="true"/>
+
 		<Region VBox.vgrow="ALWAYS"/>
-		<ButtonBar buttonMinWidth="120" buttonOrder="C+I">
+
+		<ButtonBar buttonOrder="+CI">
 			<buttons>
 				<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" onAction="#cancel"/>
 				<Button fx:id="finishButton" text="%generic.button.change" ButtonBar.buttonData="FINISH" onAction="#finish" defaultButton="true"/>

+ 12 - 10
main/ui/src/main/resources/fxml/unlock2.fxml

@@ -4,11 +4,11 @@
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.CheckBox?>
 <?import javafx.scene.control.ProgressIndicator?>
-<?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.VBox?>
 <?import javafx.scene.text.Text?>
 <?import javafx.scene.text.TextFlow?>
 <?import org.cryptomator.ui.controls.SecPasswordField?>
+<?import javafx.scene.control.ButtonBar?>
 <VBox xmlns="http://javafx.com/javafx"
 	  xmlns:fx="http://javafx.com/fxml"
 	  fx:controller="org.cryptomator.ui.unlock.UnlockController"
@@ -16,7 +16,7 @@
 	  maxWidth="300"
 	  spacing="6">
 	<padding>
-		<Insets bottom="6.0" left="6.0" right="6.0" top="6.0"/>
+		<Insets bottom="12.0" left="12.0" right="12.0" top="12.0"/>
 	</padding>
 	<children>
 		<TextFlow styleClass="text-flow">
@@ -27,13 +27,15 @@
 		</TextFlow>
 		<SecPasswordField fx:id="passwordField"/>
 		<CheckBox fx:id="savePassword" text="%unlock.savePassword" onAction="#didClickSavePasswordCheckbox"/>
-		<HBox alignment="CENTER_RIGHT" spacing="6">
-			<Button text="%generic.button.cancel" cancelButton="true" onAction="#cancel"/>
-			<Button text="%unlock.unlockBtn" defaultButton="true" onAction="#unlock" contentDisplay="${controller.unlockButtonState}" disable="${controller.unlockButtonDisabled}">
-				<graphic>
-					<ProgressIndicator progress="-1" prefWidth="12" prefHeight="12"/>
-				</graphic>
-			</Button>
-		</HBox>
+		<ButtonBar buttonOrder="+CI">
+			<buttons>
+				<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#cancel"/>
+				<Button text="%unlock.unlockBtn" defaultButton="true" ButtonBar.buttonData="FINISH" onAction="#unlock" contentDisplay="${controller.unlockButtonState}" disable="${controller.unlockButtonDisabled}">
+					<graphic>
+						<ProgressIndicator progress="-1" prefWidth="12" prefHeight="12"/>
+					</graphic>
+				</Button>
+			</buttons>
+		</ButtonBar>
 	</children>
 </VBox>

+ 5 - 3
main/ui/src/main/resources/fxml/vault_detail.fxml

@@ -71,8 +71,10 @@
 				<Label styleClass="button-group-action" text="EXAMPLE ACTION"/>
 			</HBox>
 		</VBox>
-		<Region prefHeight="24"/>
-		<HBox alignment="CENTER" spacing="6" visible="${controller.vault.locked}" managed="${controller.vault.locked}">
+
+		<Region prefHeight="24" VBox.vgrow="NEVER"/>
+
+		<HBox alignment="CENTER" spacing="12" visible="${controller.vault.locked}" managed="${controller.vault.locked}">
 			<Button styleClass="button-large" text="%vaultDetail.unlockBtn" onAction="#unlock" defaultButton="${controller.vault.locked}">
 				<graphic>
 					<FontAwesome5IconView glyph="LOCK_OPEN_ALT" glyphSize="15"/>
@@ -84,7 +86,7 @@
 				</graphic>
 			</Button>
 		</HBox>
-		<VBox alignment="CENTER" spacing="6" visible="${controller.vault.unlocked}" managed="${controller.vault.unlocked}">
+		<VBox alignment="CENTER" spacing="12" visible="${controller.vault.unlocked}" managed="${controller.vault.unlocked}">
 			<Button styleClass="button-large" text="%vaultDetail.lockBtn" onAction="#lock" defaultButton="${controller.vault.unlocked}">
 				<graphic>
 					<FontAwesome5IconView glyph="LOCK_ALT" glyphSize="15"/>

+ 2 - 2
main/ui/src/main/resources/fxml/vault_options_mount.fxml

@@ -15,14 +15,14 @@
 		<Insets bottom="12" left="12" right="12" top="12"/>
 	</padding>
 	<children>
-		<HBox spacing="12" alignment="BASELINE_LEFT">
+		<HBox spacing="6" alignment="BASELINE_LEFT">
 			<Label text="%vaultOptions.mount.driveName"/>
 			<AlphanumericTextField fx:id="driveName"/>
 		</HBox>
 
 		<CheckBox fx:id="readOnlyCheckbox" text="%vaultOptions.mount.readonly"/>
 
-		<HBox spacing="12" alignment="BASELINE_LEFT">
+		<HBox spacing="6" alignment="BASELINE_LEFT">
 			<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags"/>
 			<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity"/>
 		</HBox>

+ 5 - 2
main/ui/src/main/resources/i18n/strings.properties

@@ -35,8 +35,11 @@ addvaultwizard.existing.filePickerTitle=Select Masterkey File
 # Change Password
 changepassword.title=Change Password
 changepassword.enterOldPassword=To change the password, please enter the current password for
-changepassword.enterNewPassword=Please enter a new password:
-changepassword.reenterNewPassword=Please reenter the new password:
+changepassword.enterNewPassword=Please enter a new password for your vault:
+changepassword.reenterNewPassword=Please confirm the new password:
+changepassword.passwordsMatch=Passwords match!
+changepassword.passwordsDoNotMatch=Passwords do not match
+changepassword.finalConfirmation=I understand that I will not be able to recover my data if I forget my password
 
 # Unlock
 unlock.title=Unlock Vault