Do not ask for github passford so often

This commit is contained in:
Oleg Shpynov
2011-04-19 17:27:03 +04:00
parent 07ae058361
commit 3adde45493
@@ -49,6 +49,7 @@ public class GithubSettings implements PersistentStateComponent<Element> {
private String myLogin;
private String myHost;
private static final Logger LOG = Logger.getInstance(GithubSettings.class.getName());
private String myPassword;
public static GithubSettings getInstance(){
return ServiceManager.getService(GithubSettings.class);
@@ -81,12 +82,16 @@ public class GithubSettings implements PersistentStateComponent<Element> {
@Nullable
public String getPassword() {
try {
return PasswordSafe.getInstance().getPassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY);
}
catch (PasswordSafeException e) {
return "";
if (myPassword == null){
try {
myPassword = PasswordSafe.getInstance().getPassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY);
}
catch (PasswordSafeException e) {
myPassword = null;
return "";
}
}
return myPassword;
}
public String getHost() {
@@ -98,6 +103,7 @@ public class GithubSettings implements PersistentStateComponent<Element> {
}
public void setPassword(final String password) {
myPassword = password;
try {
PasswordSafe.getInstance().storePassword(null, GithubSettings.class, GITHUB_SETTINGS_PASSWORD_KEY, password);
}