Keychain is locked (#1550)

Fixes #1526

Co-authored-by: Sebastian Stenzel <overheadhunter@users.noreply.github.com>
Co-authored-by: Sebastian Stenzel <sebastian.stenzel@gmail.com>
This commit is contained in:
Ralph Plawetzki
2021-06-02 14:24:51 +02:00
committed by GitHub
parent 1159681824
commit 7b689c6b78
4 changed files with 5 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ public class ChangePasswordController implements FxController {
}
private void updatePasswordInSystemkeychain() {
if (keychain.isSupported()) {
if (keychain.isSupported() && !keychain.isLocked()) {
try {
keychain.changePassphrase(vault.getId(), newPasswordController.passwordField.getCharacters());
LOG.info("Successfully updated password in system keychain for {}", vault.getDisplayName());

View File

@@ -59,7 +59,7 @@ public abstract class MasterkeyFileLoadingModule {
@Named("savedPassword")
@KeyLoadingScoped
static Optional<char[]> provideStoredPassword(KeychainManager keychain, @KeyLoading Vault vault) {
if (!keychain.isSupported()) {
if (!keychain.isSupported() || keychain.isLocked()) {
return Optional.empty();
} else {
try {

View File

@@ -36,7 +36,7 @@ public class VaultDetailLockedController implements FxController {
this.vaultOptionsWindow = vaultOptionsWindow;
this.keychain = keychain;
this.mainWindow = mainWindow;
if (keychain.isSupported()) {
if (keychain.isSupported() && !keychain.isLocked()) {
this.passwordSaved = BooleanExpression.booleanExpression(EasyBind.select(vault).selectObject(v -> keychain.getPassphraseStoredProperty(v.getId())));
} else {
this.passwordSaved = new SimpleBooleanProperty(false);

View File

@@ -36,7 +36,7 @@ public class MasterkeyOptionsController implements FxController {
this.changePasswordWindow = changePasswordWindow;
this.recoveryKeyWindow = recoveryKeyWindow;
this.keychain = keychain;
if (keychain.isSupported()) {
if (keychain.isSupported() && !keychain.isLocked()) {
this.passwordSaved = Bindings.createBooleanBinding(this::isPasswordSaved, keychain.getPassphraseStoredProperty(vault.getId()));
} else {
this.passwordSaved = new SimpleBooleanProperty(false);
@@ -74,7 +74,7 @@ public class MasterkeyOptionsController implements FxController {
}
public boolean isPasswordSaved() {
if (keychain.isSupported() && vault != null) {
if (keychain.isSupported() && !keychain.isLocked() && vault != null) {
return keychain.getPassphraseStoredProperty(vault.getId()).get();
} else return false;
}