This commit is contained in:
Jan-Peter Klein
2025-08-21 12:26:16 +02:00
parent fa053ac3df
commit 16d441ec44
15 changed files with 78 additions and 93 deletions

View File

@@ -79,11 +79,6 @@ public class VaultDetailMissingVaultController implements FxController {
}
}
@FXML
void restoreMasterkey() {
recoveryKeyWindow.create(vault.get(), window, new SimpleObjectProperty<>(RecoveryActionType.RESTORE_MASTERKEY)).showRecoveryKeyRecoverWindow();
}
@FXML
public void unlock() {
vault.get().stateProperty().set(VaultState.Value.LOCKED);

View File

@@ -20,9 +20,9 @@ import javafx.stage.Stage;
import java.util.EnumSet;
import java.util.Objects;
import static org.cryptomator.common.vaults.VaultState.Value.ALL_MISSING;
import static org.cryptomator.common.vaults.VaultState.Value.ERROR;
import static org.cryptomator.common.vaults.VaultState.Value.LOCKED;
import static org.cryptomator.common.vaults.VaultState.Value.ALL_MISSING;
import static org.cryptomator.common.vaults.VaultState.Value.MISSING;
import static org.cryptomator.common.vaults.VaultState.Value.NEEDS_MIGRATION;
import static org.cryptomator.common.vaults.VaultState.Value.UNLOCKED;

View File

@@ -63,12 +63,10 @@ public class RecoveryKeyCreationController implements FxController {
public Button nextButton;
private final VaultListManager vaultListManager;
private final Dialogs dialogs;
private final Stage owner;
@Inject
public RecoveryKeyCreationController(FxApplicationWindows appWindows, //
@RecoveryKeyWindow Stage window, //
@Named("keyRecoveryOwner") Stage owner, //
@FxmlScene(FxmlFile.RECOVERYKEY_SUCCESS) Lazy<Scene> successScene, //
@FxmlScene(FxmlFile.RECOVERYKEY_EXPERT_SETTINGS) Lazy<Scene> recoverykeyExpertSettingsScene, //
@RecoveryKeyWindow Vault vault, //
@@ -94,7 +92,6 @@ public class RecoveryKeyCreationController implements FxController {
this.masterkeyFileAccess = masterkeyFileAccess;
this.shorteningThreshold = shorteningThreshold;
this.vaultListManager = vaultListManager;
this.owner = owner;
this.dialogs = dialogs;
}
@@ -175,7 +172,6 @@ public class RecoveryKeyCreationController implements FxController {
}
}
@FXML
public void close() {
window.close();

View File

@@ -152,4 +152,3 @@ public class RecoveryKeyOnboardingController implements FxController {
}
}

View File

@@ -13,7 +13,6 @@ import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import java.util.Objects;
import java.util.ResourceBundle;
@RecoveryKeyScoped
@@ -33,15 +32,15 @@ public class RecoveryKeyRecoverController implements FxController {
@Inject
public RecoveryKeyRecoverController(@RecoveryKeyWindow Stage window, //
ResourceBundle resourceBundle, //
@FxmlScene(FxmlFile.RECOVERYKEY_RESET_PASSWORD) Lazy<Scene> resetPasswordScene, //
@FxmlScene(FxmlFile.RECOVERYKEY_EXPERT_SETTINGS) Lazy<Scene> expertSettingsScene, //
@FxmlScene(FxmlFile.RECOVERYKEY_ONBOARDING) Lazy<Scene> onBoardingScene, //
ResourceBundle resourceBundle, //
@Named("recoverType") ObjectProperty<RecoveryActionType> recoverType) {
this.window = window;
this.recoverType = recoverType;
this.onBoardingScene = onBoardingScene;
this.resourceBundle = resourceBundle;
this.onBoardingScene = onBoardingScene;
this.recoverType = recoverType;
this.nextScene = switch (recoverType.get()) {
case RESTORE_ALL, RESTORE_VAULT_CONFIG -> {
window.setTitle(resourceBundle.getString("recoveryKey.recoverVaultConfig.title"));
@@ -61,7 +60,6 @@ public class RecoveryKeyRecoverController implements FxController {
}
default -> throw new IllegalArgumentException("Unexpected recovery action type: " + recoverType.get());
};
}
@FXML

View File

@@ -153,10 +153,12 @@ public class RecoveryKeyResetPasswordController implements FxController {
public void resetPassword() {
Task<Void> task = new ResetPasswordTask();
task.setOnScheduled(_ -> LOG.debug("Using recovery key to reset password for {}.", vault.getDisplayablePath()));
task.setOnScheduled(_ -> {
LOG.debug("Using recovery key to reset password for {}.", vault.getDisplayablePath());
});
task.setOnSucceeded(_ -> {
LOG.info("Used recovery key to reset password for {}.", vault.getDisplayablePath());
LOG.debug("Used recovery key to reset password for {}.", vault.getDisplayablePath());
window.close();
switch (recoverType.get()){
case RESET_PASSWORD -> dialogs.prepareRecoverPasswordSuccess(window).build().showAndWait();
@@ -172,16 +174,6 @@ public class RecoveryKeyResetPasswordController implements FxController {
executor.submit(task);
}
/* Getter/Setter */
public ReadOnlyBooleanProperty passwordSufficientAndMatchingProperty() {
return newPasswordController.goodPasswordProperty();
}
public boolean isPasswordSufficientAndMatching() {
return newPasswordController.isGoodPassword();
}
private class ResetPasswordTask extends Task<Void> {
private static final Logger LOG = LoggerFactory.getLogger(ResetPasswordTask.class);
@@ -196,4 +188,15 @@ public class RecoveryKeyResetPasswordController implements FxController {
return null;
}
}
/* Getter/Setter */
public ReadOnlyBooleanProperty passwordSufficientAndMatchingProperty() {
return newPasswordController.goodPasswordProperty();
}
public boolean isPasswordSufficientAndMatching() {
return newPasswordController.isGoodPassword();
}
}