mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-18 05:06:02 +00:00
fixes #382
This commit is contained in:
@@ -30,6 +30,7 @@ import org.cryptomator.ui.model.Vault;
|
||||
import org.cryptomator.ui.settings.Localization;
|
||||
import org.cryptomator.ui.settings.Settings;
|
||||
import org.cryptomator.ui.util.AsyncTaskService;
|
||||
import org.cryptomator.ui.util.DialogBuilderUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -40,7 +41,9 @@ import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Hyperlink;
|
||||
@@ -276,6 +279,37 @@ public class UnlockController extends LocalizedFXMLViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// ****************************************
|
||||
// Save password checkbox
|
||||
// ****************************************
|
||||
|
||||
@FXML
|
||||
private void didClickSavePasswordCheckbox(ActionEvent event) {
|
||||
if (!savePassword.isSelected() && hasStoredPassword()) {
|
||||
Alert confirmDialog = DialogBuilderUtil.buildConfirmationDialog( //
|
||||
localization.getString("unlock.savePassword.delete.confirmation.title"), //
|
||||
localization.getString("unlock.savePassword.delete.confirmation.header"), //
|
||||
localization.getString("unlock.savePassword.delete.confirmation.content"), //
|
||||
SystemUtils.IS_OS_MAC_OSX ? ButtonType.CANCEL : ButtonType.OK);
|
||||
|
||||
Optional<ButtonType> choice = confirmDialog.showAndWait();
|
||||
if (ButtonType.OK.equals(choice.get())) {
|
||||
keychainAccess.get().deletePassphrase(vault.getId());
|
||||
} else if (ButtonType.CANCEL.equals(choice.get())) {
|
||||
savePassword.setSelected(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasStoredPassword() {
|
||||
char[] storedPw = keychainAccess.get().loadPassphrase(vault.getId());
|
||||
boolean hasPw = (storedPw != null);
|
||||
if (storedPw != null) {
|
||||
Arrays.fill(storedPw, ' ');
|
||||
}
|
||||
return hasPw;
|
||||
}
|
||||
|
||||
// ****************************************
|
||||
// Unlock button
|
||||
// ****************************************
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
<!-- Row 3.1 -->
|
||||
<Label GridPane.rowIndex="1" GridPane.columnIndex="0" text="%unlock.label.savePassword" cacheShape="true" cache="true" />
|
||||
<CheckBox GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="savePassword" cacheShape="true" cache="true" />
|
||||
<CheckBox GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="savePassword" onAction="#didClickSavePasswordCheckbox" cacheShape="true" cache="true" />
|
||||
|
||||
<!-- Row 3.2 -->
|
||||
<Label GridPane.rowIndex="2" GridPane.columnIndex="0" text="%unlock.label.mountName" cacheShape="true" cache="true" />
|
||||
|
||||
@@ -58,6 +58,9 @@ unlock.label.advancedHeading=Advanced options
|
||||
unlock.button.unlock=Unlock vault
|
||||
unlock.button.advancedOptions.show=More options
|
||||
unlock.button.advancedOptions.hide=Less options
|
||||
unlock.savePassword.delete.confirmation.title=Delete Saved Password
|
||||
unlock.savePassword.delete.confirmation.header=Do you really want to delete the saved password of this vault?
|
||||
unlock.savePassword.delete.confirmation.content=The saved password of this vault will be immediately deleted from your system keychain. If you'd like to save your password again, you'd have to unlock your vault with the "Save password" option enabled.
|
||||
unlock.choicebox.winDriveLetter.auto=Assign automatically
|
||||
unlock.errorMessage.wrongPassword=Wrong password
|
||||
unlock.errorMessage.mountingFailed=Mounting failed. See log file for details.
|
||||
|
||||
Reference in New Issue
Block a user