mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-17 04:36:02 +00:00
Merge pull request #4120 from cryptomator/feature/disable-password-tab-if-masterkey-missing
Disable recovery key actions in Vault Password options when masterkey is missing
This commit is contained in:
@@ -9,11 +9,15 @@ import org.cryptomator.ui.forgetpassword.ForgetPasswordComponent;
|
||||
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.Stage;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import static org.cryptomator.common.Constants.MASTERKEY_FILENAME;
|
||||
|
||||
@VaultOptionsScoped
|
||||
public class MasterkeyOptionsController implements FxController {
|
||||
@@ -25,6 +29,7 @@ public class MasterkeyOptionsController implements FxController {
|
||||
private final ForgetPasswordComponent.Builder forgetPasswordWindow;
|
||||
private final KeychainManager keychain;
|
||||
private final ObservableValue<Boolean> passwordSaved;
|
||||
private final BooleanProperty masterkeyFileAvailable;
|
||||
|
||||
|
||||
@Inject
|
||||
@@ -40,6 +45,7 @@ public class MasterkeyOptionsController implements FxController {
|
||||
} else {
|
||||
this.passwordSaved = new SimpleBooleanProperty(false);
|
||||
}
|
||||
this.masterkeyFileAvailable = new SimpleBooleanProperty(Files.exists(vault.getPath().resolve(MASTERKEY_FILENAME)));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -70,4 +76,12 @@ public class MasterkeyOptionsController implements FxController {
|
||||
public boolean isPasswordSaved() {
|
||||
return passwordSaved.getValue();
|
||||
}
|
||||
|
||||
public BooleanProperty masterkeyFileAvailableProperty() {
|
||||
return masterkeyFileAvailable;
|
||||
}
|
||||
|
||||
public boolean isMasterkeyFileAvailable() {
|
||||
return masterkeyFileAvailable.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Circle?>
|
||||
<?import javafx.scene.Group?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="org.cryptomator.ui.vaultoptions.MasterkeyOptionsController"
|
||||
@@ -15,7 +19,21 @@
|
||||
<Insets topRightBottomLeft="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<VBox spacing="6" alignment="CENTER">
|
||||
<HBox spacing="12" visible="${!controller.masterkeyFileAvailable}" managed="${!controller.masterkeyFileAvailable}">
|
||||
<padding>
|
||||
<Insets bottom="12"/>
|
||||
</padding>
|
||||
<Group>
|
||||
<StackPane>
|
||||
<Circle styleClass="glyph-icon-primary" radius="18"/>
|
||||
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="INFO" glyphSize="18"/>
|
||||
</StackPane>
|
||||
</Group>
|
||||
<HBox spacing="6" HBox.hgrow="ALWAYS">
|
||||
<Label text="%vaultOptions.masterkey.missingMasterkeyFile" wrapText="true" HBox.hgrow="ALWAYS"/>
|
||||
</HBox>
|
||||
</HBox>
|
||||
<VBox spacing="6" alignment="CENTER" disable="${!controller.masterkeyFileAvailable}">
|
||||
<Button text="%vaultOptions.masterkey.changePasswordBtn" onAction="#changePassword" contentDisplay="LEFT" maxWidth="Infinity">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="KEY"/>
|
||||
@@ -29,8 +47,8 @@
|
||||
</Button>
|
||||
</VBox>
|
||||
<Region VBox.vgrow="ALWAYS"/>
|
||||
<Label maxWidth="-Infinity" text="%vaultOptions.masterkey.recoveryKeyExplanation" wrapText="true"/>
|
||||
<VBox spacing="6" alignment="CENTER">
|
||||
<Label maxWidth="-Infinity" text="%vaultOptions.masterkey.recoveryKeyExplanation" wrapText="true" disable="${!controller.masterkeyFileAvailable}"/>
|
||||
<VBox spacing="6" alignment="CENTER" disable="${!controller.masterkeyFileAvailable}">
|
||||
<Button text="%vaultOptions.masterkey.showRecoveryKeyBtn" onAction="#showRecoveryKey" contentDisplay="LEFT" maxWidth="Infinity">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="EYE"/>
|
||||
|
||||
@@ -522,6 +522,7 @@ vaultOptions.masterkey.forgetSavedPasswordBtn=Forget Saved Password
|
||||
vaultOptions.masterkey.recoveryKeyExplanation=A recovery key is your only means to restore access to a vault if you lose your password.
|
||||
vaultOptions.masterkey.showRecoveryKeyBtn=Display Recovery Key
|
||||
vaultOptions.masterkey.recoverPasswordBtn=Reset Password
|
||||
vaultOptions.masterkey.missingMasterkeyFile=These options are only available if the masterkey file is present in the vault directory.
|
||||
## Hub
|
||||
vaultOptions.hub=Recovery
|
||||
vaultOptions.hub.convertInfo=You can use the recovery key to convert this Hub vault to a password-based vault in an emergency.
|
||||
|
||||
Reference in New Issue
Block a user