name the reenter field properly

This commit is contained in:
Armin Schrenk
2019-08-14 17:37:42 +02:00
parent 0a132351a8
commit 8c9d78337e
3 changed files with 10 additions and 10 deletions
@@ -47,7 +47,7 @@ public class CreateNewVaultPasswordController implements FxController {
public Button finishButton;
public SecPasswordField passwordField;
public SecPasswordField retypeField;
public SecPasswordField reenterField;
public Region passwordStrengthLevel0;
public Region passwordStrengthLevel1;
public Region passwordStrengthLevel2;
@@ -77,15 +77,15 @@ public class CreateNewVaultPasswordController implements FxController {
//binds the actual strength value to the rating of the password util
passwordStrength.bind(Bindings.createIntegerBinding(() -> strengthRater.computeRate(passwordField.getCharacters().toString()), passwordField.textProperty()));
//binding indicating if the passwords not match
BooleanBinding passwordsMatch = Bindings.createBooleanBinding(() -> CharSequence.compare(passwordField.getCharacters(), retypeField.getCharacters()) == 0, passwordField.textProperty(), retypeField.textProperty());
BooleanBinding retypteFieldNotEmpty = retypeField.textProperty().isNotEmpty();
BooleanBinding passwordsMatch = Bindings.createBooleanBinding(() -> CharSequence.compare(passwordField.getCharacters(), reenterField.getCharacters()) == 0, passwordField.textProperty(), reenterField.textProperty());
BooleanBinding reenterFieldNotEmpty = reenterField.textProperty().isNotEmpty();
//disable the finish button when passwords do not match or one is empty
finishButton.disableProperty().bind(retypteFieldNotEmpty.not().or(passwordsMatch.not()));
finishButton.disableProperty().bind(reenterFieldNotEmpty.not().or(passwordsMatch.not()));
//make match indicator invisible when passwords do not match or one is empty
passwordMatchBox.visibleProperty().bind(retypteFieldNotEmpty);
checkmark.visibleProperty().bind(passwordsMatch.and(retypteFieldNotEmpty));
cross.visibleProperty().bind(passwordsMatch.not().and(retypteFieldNotEmpty));
passwordMatchLabel.textProperty().bind(Bindings.when(passwordsMatch.and(retypteFieldNotEmpty)).then(resourceBundle.getString("addvaultwizard.new.passwordsMatch")).otherwise(resourceBundle.getString("addvaultwizard.new.passwordsDoNotMatch")));
passwordMatchBox.visibleProperty().bind(reenterFieldNotEmpty);
checkmark.visibleProperty().bind(passwordsMatch.and(reenterFieldNotEmpty));
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")));
//bindsings for the password strength indicator
passwordStrengthLevel0.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(0), strengthRater::getBackgroundWithStrengthColor));
@@ -32,7 +32,7 @@
<Label fx:id="passwordStrengthLabel" styleClass="caption-label" />
<Region VBox.vgrow="ALWAYS"/>
<Label text="%addvaultwizard.new.reenterPassword"/>
<SecPasswordField fx:id="retypeField"/>
<SecPasswordField fx:id="reenterField"/>
<HBox fx:id="passwordMatchBox" spacing="12.0" alignment="BASELINE_RIGHT" >
<!-- TODO
<ImageView fx:id="checkmark" image="/path/to/checkmark" fitWidth="10" fitHeight="10" />
@@ -24,7 +24,7 @@ addvaultwizard.new.locationPrompt=TODO location
addvaultwizard.new.directoryPickerButton=Choose...
addvaultwizard.new.directoryPickerTitle=Select Directory
addvaultwizard.new.enterPassword=Please enter a Password for your vault:
addvaultwizard.new.reenterPassword=Please retype the password:
addvaultwizard.new.reenterPassword=Please enter the password again:
addvaultwizard.new.passwordsMatch=Passwords match!
addvaultwizard.new.passwordsDoNotMatch=Passwords do not match.