Pass the name of the vault on changing a passphrase

This commit is contained in:
Ralph Plawetzki
2021-10-06 07:53:38 +02:00
parent 54a005a5c9
commit 445cb7e242
2 changed files with 9 additions and 1 deletions

View File

@@ -76,6 +76,14 @@ public class KeychainManager implements KeychainAccessProvider {
}
}
@Override
public void changePassphrase(String key, String displayName, CharSequence passphrase) throws KeychainAccessException {
if (isPassphraseStored(key)) {
getKeychainOrFail().changePassphrase(key, displayName, passphrase);
setPassphraseStored(key, true);
}
}
@Override
public boolean isSupported() {
return keychain.getValue() != null;

View File

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