mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-19 19:21:27 +00:00
Revert "Change existing keychain entry"
This reverts commit 9cc863ae79.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package org.cryptomator.ui.vaultoptions;
|
||||
|
||||
import org.cryptomator.common.Passphrase;
|
||||
import org.cryptomator.common.keychain.KeychainManager;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.integrations.keychain.KeychainAccessException;
|
||||
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.forgetpassword.ForgetPasswordComponent;
|
||||
@@ -12,7 +10,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
@@ -52,32 +49,6 @@ public class MasterkeyOptionsController implements FxController {
|
||||
@FXML
|
||||
public void initialize() {
|
||||
useTouchIDheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().useTouchID);
|
||||
useTouchIDheckbox.selectedProperty().addListener(this::useTouchIDheckboxToggled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Existing keychain items get changed, depending on an additional user authentication is required or not.
|
||||
* This is needed as the user authentication is tied to the keychain itself.
|
||||
*
|
||||
* @param observable
|
||||
* @param wasSet
|
||||
* @param isSet <code>true</code>, when the checkbox is ticked, <code>false</code> otherwise
|
||||
*/
|
||||
private void useTouchIDheckboxToggled(Observable observable, Boolean wasSet, Boolean isSet) {
|
||||
try {
|
||||
var vautID = vault.getId();
|
||||
if (keychain.isPassphraseStored(vautID)) {
|
||||
var passphrase = keychain.loadPassphrase(vautID);
|
||||
keychain.deletePassphrase(vautID);
|
||||
if (isSet) {
|
||||
keychain.storePassphraseForAuthenticatedUser(vautID, vault.getId(), new Passphrase(passphrase));
|
||||
} else {
|
||||
keychain.storePassphrase(vautID, vault.getId(), new Passphrase(passphrase));
|
||||
}
|
||||
}
|
||||
} catch (KeychainAccessException e) {
|
||||
LOG.error("Failed to migrate item in system keychain due to access control change.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
||||
Reference in New Issue
Block a user