set isCheckExistingBeforeDialog to false by default for simplicity

This commit is contained in:
Vladimir Krivosheev
2018-05-17 15:37:36 +02:00
parent 3edb86b011
commit 058d224c56
4 changed files with 17 additions and 58 deletions
@@ -31,7 +31,10 @@ fun askPassword(project: Project?,
attributes: CredentialAttributes,
resetPassword: Boolean = false,
error: String? = null): String? {
return askCredentials(project, dialogTitle, passwordFieldLabel, attributes, resetPassword = resetPassword, error = error)?.credentials?.getPasswordAsString()?.nullize()
return askCredentials(project, dialogTitle, passwordFieldLabel, attributes,
isResetPassword = resetPassword,
error = error,
isCheckExistingBeforeDialog = true)?.credentials?.getPasswordAsString()?.nullize()
}
internal object RememberCheckBoxState {
@@ -54,14 +57,14 @@ fun askCredentials(project: Project?,
passwordFieldLabel: String,
attributes: CredentialAttributes,
isSaveOnOk: Boolean = true,
checkExistingBeforeDialog: Boolean = true,
resetPassword: Boolean = false,
isCheckExistingBeforeDialog: Boolean = false,
isResetPassword: Boolean = false,
error: String? = null): CredentialRequestResult? {
val store = PasswordSafe.getInstance()
if (resetPassword) {
if (isResetPassword) {
store.set(attributes, null)
}
else if (checkExistingBeforeDialog) {
else if (isCheckExistingBeforeDialog) {
store.get(attributes)?.let {
return CredentialRequestResult(it, false, true)
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.passwordSafe.ui;
import com.intellij.openapi.ui.Messages;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.passwordSafe.ui
import com.intellij.credentialStore.CredentialAttributes
@@ -24,8 +10,7 @@ object PasswordSafePromptDialog {
@Deprecated("Use {@link CredentialPromptDialog}",
ReplaceWith("askPassword(project, title, message, CredentialAttributes(requestor, key), resetPassword, error)", "com.intellij.credentialStore.askPassword",
"com.intellij.credentialStore.CredentialAttributes"))
fun askPassword(project: Project?,
title: String,
fun askPassword(project: Project?, title: String,
message: String,
requestor: Class<*>,
key: String,
@@ -33,5 +18,4 @@ object PasswordSafePromptDialog {
error: String): String? {
return askPassword(project, title, message, CredentialAttributes(requestor, key), resetPassword, error)
}
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package git4idea.commands;
import com.intellij.credentialStore.CredentialAttributes;
@@ -71,9 +57,9 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
@Nullable private String myPasswordKey;
@Nullable private String myUnifiedUrl;
@Nullable private String myLogin;
private ThreeState myIsMemoryOnly = ThreeState.UNSURE;
@Nullable private GitHttpAuthDataProvider myDataProvider;
private boolean myWasCancelled;
@@ -112,7 +98,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
myPasswordKey = getUnifiedUrl(url);
CredentialRequestResult result = CredentialPromptDialog.askCredentials(myProject,
myTitle, "Password for " + getDisplayableUrl(url),
credentialAttributes(myPasswordKey), false, false);
credentialAttributes(myPasswordKey), false);
String password = result == null ? null : result.getCredentials().getPasswordAsString();
LOG.debug("askPassword. Password was asked and returned: " + (password == null ? "NULL" : password.isEmpty() ? "EMPTY" : "NOT EMPTY"));
if (password == null) {
@@ -274,7 +260,7 @@ class GitHttpGuiAuthenticator implements GitHttpAuthenticator {
}
return candidate;
}
@NotNull
private List<GitHttpAuthDataProvider> getProviders() {
List<GitHttpAuthDataProvider> providers = ContainerUtil.newArrayList();