Revert "Code cleanups following coderabbitai recommendations"

This reverts commit af3779ba2e.
This commit is contained in:
Ralph Plawetzki
2024-12-02 08:12:01 +01:00
parent 5c34f59d09
commit ba84da71f3

View File

@@ -54,9 +54,10 @@ public class MasterkeyOptionsController implements FxController {
public void initialize() {
needAuthenticatedUserCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().needAuthenticatedUser);
needAuthenticatedUserCheckbox.selectedProperty().addListener(this::needAuthenticatedUserCheckboxToggled);
// ToDo Remove or adjust, as soon as there are implementations for integrations-api KeychainAccessProvider:storePassphraseForAuthenticatedUser for other OSes
// ToDo Remove or adjust, as soon as there are implementations for integrations-api
// KeychainAccessProvider:storePassphraseForAuthenticatedUser for other OSes
if (!SystemUtils.IS_OS_MAC) {
needAuthenticatedUserCheckbox.setVisible(false);
needAuthenticatedUserCheckbox.visibleProperty().set(false);
}
}
@@ -70,14 +71,14 @@ public class MasterkeyOptionsController implements FxController {
*/
private void needAuthenticatedUserCheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
try {
var vaultId = vault.getId();
if (keychain.isPassphraseStored(vaultId)) {
var passphrase = keychain.loadPassphrase(vaultId);
keychain.deletePassphrase(vaultId);
var vautID = vault.getId();
if (keychain.isPassphraseStored(vautID)) {
var passphrase = keychain.loadPassphrase(vautID);
keychain.deletePassphrase(vautID);
if (isSet) {
keychain.storePassphraseForAuthenticatedUser(vaultId, vault.getId(), new Passphrase(passphrase));
keychain.storePassphraseForAuthenticatedUser(vautID, vault.getId(), new Passphrase(passphrase));
} else {
keychain.storePassphrase(vaultId, vault.getId(), new Passphrase(passphrase));
keychain.storePassphrase(vautID, vault.getId(), new Passphrase(passphrase));
}
}
} catch (KeychainAccessException e) {