fixing bug where unlock dialog is not shown anymore

This commit is contained in:
Armin Schrenk
2020-04-28 19:43:10 +02:00
parent 670d4a165c
commit 8aa3da14a4
2 changed files with 4 additions and 1 deletions

View File

@@ -91,8 +91,10 @@ public class UnlockController implements FxController {
Task<Vault> task = vaultService.createUnlockTask(vault, password); Task<Vault> task = vaultService.createUnlockTask(vault, password);
passwordField.setDisable(true); passwordField.setDisable(true);
savePassword.setDisable(true);
task.setOnSucceeded(event -> { task.setOnSucceeded(event -> {
passwordField.setDisable(false); passwordField.setDisable(false);
savePassword.setDisable(!keychainAccess.isPresent());
if (keychainAccess.isPresent() && savePassword.isSelected()) { if (keychainAccess.isPresent() && savePassword.isSelected()) {
try { try {
keychainAccess.get().storePassphrase(vault.getId(), password); keychainAccess.get().storePassphrase(vault.getId(), password);
@@ -106,6 +108,7 @@ public class UnlockController implements FxController {
}); });
task.setOnFailed(event -> { task.setOnFailed(event -> {
passwordField.setDisable(false); passwordField.setDisable(false);
savePassword.setDisable(!keychainAccess.isPresent());
if (task.getException() instanceof InvalidPassphraseException) { if (task.getException() instanceof InvalidPassphraseException) {
Animations.createShakeWindowAnimation(window).play(); Animations.createShakeWindowAnimation(window).play();
passwordField.selectAll(); passwordField.selectAll();

View File

@@ -22,7 +22,7 @@
<VBox spacing="6"> <VBox spacing="6">
<FormattedLabel format="%unlock.passwordPrompt" arg1="${controller.vault.displayableName}" wrapText="true"/> <FormattedLabel format="%unlock.passwordPrompt" arg1="${controller.vault.displayableName}" wrapText="true"/>
<NiceSecurePasswordField fx:id="passwordField"/> <NiceSecurePasswordField fx:id="passwordField"/>
<CheckBox fx:id="savePassword" text="%unlock.savePassword" onAction="#didClickSavePasswordCheckbox" disable="${controller.vault.processing}"/> <CheckBox fx:id="savePassword" text="%unlock.savePassword" onAction="#didClickSavePasswordCheckbox"/>
</VBox> </VBox>
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS"> <VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">