diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java index 399fa14d078c..9a94824e2dcf 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/execution/HgCommandAuthenticator.java @@ -15,8 +15,6 @@ package org.zmlx.hg4idea.execution; import com.intellij.ide.passwordSafe.PasswordSafe; import com.intellij.ide.passwordSafe.PasswordSafeException; import com.intellij.ide.passwordSafe.impl.PasswordSafeImpl; -import com.intellij.ide.passwordSafe.impl.PasswordSafeProvider; -import com.intellij.ide.passwordSafe.impl.providers.masterKey.MasterKeyPasswordSafe; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; @@ -55,10 +53,13 @@ class HgCommandAuthenticator { final String url = VirtualFileManager.extractPath(myRunnable.getURL()); final String key = keyForUrlAndLogin(url, myRunnable.getUserName()); - final PasswordSafeProvider provider = - myRunnable.isRememberPassword() ? passwordSafe.getMasterKeyProvider() : passwordSafe.getMemoryProvider(); try { - provider.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); + if (myRunnable.isRememberPassword()) { + //save password to memory, despite of settings-> passwords + //todo should be reworked + passwordSafe.getMemoryProvider().storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); + } + passwordSafe.storePassword(myProject, HgCommandAuthenticator.class, key, myRunnable.getPassword()); final HgVcs vcs = HgVcs.getInstance(myProject); if (vcs != null) { vcs.getGlobalSettings().addRememberedUrl(url, myRunnable.getUserName()); @@ -129,13 +130,7 @@ class HgCommandAuthenticator { final PasswordSafeImpl passwordSafe = (PasswordSafeImpl)PasswordSafe.getInstance(); password = passwordSafe.getMemoryProvider().getPassword(myProject, HgCommandAuthenticator.class, key); if (password == null) { - final MasterKeyPasswordSafe masterKeyProvider = passwordSafe.getMasterKeyProvider(); - if (!masterKeyProvider.isEmpty()) { - // workaround for: don't ask for master password, if the requested password is not there. - // this should be fixed in PasswordSafe: don't ask master password to look for keys - // until then we assume that is PasswordSafe was used (there is anything there), then it makes sense to look there. - password = masterKeyProvider.getPassword(myProject, HgCommandAuthenticator.class, key); - } + password = passwordSafe.getPassword(myProject, HgCommandAuthenticator.class, key); } } catch (PasswordSafeException e) { LOG.info("Couldn't get password for key [" + key + "]", e);