diff options
-rw-r--r-- | main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs index 525c0d2610..a3f1e5d0f4 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitCredentials.cs @@ -35,7 +35,7 @@ namespace MonoDevelop.VersionControl.Git { public class GitCredentials: CredentialsProvider { - DateTime LastAsked { + bool HasReset { get; set; } @@ -60,8 +60,7 @@ namespace MonoDevelop.VersionControl.Git if (TryGetUsernamePassword (uri, items, out passwordItem) || TryGetPassphrase (uri, items, out passphraseItem)) { // If the password store has a password and we already tried using it, it could be incorrect. // If this happens, do not return true and ask the user for a new password. - if (!ProbablyIncorrect ()) { - LastAsked = DateTime.Now; + if (!HasReset) { return true; } } @@ -75,7 +74,7 @@ namespace MonoDevelop.VersionControl.Git } }); - LastAsked = DateTime.Now; + HasReset = false; if (result) { if (passwordItem != null) { PasswordService.AddWebPassword (new Uri (uri.ToString ()), new string (passwordItem.GetValue ())); @@ -86,11 +85,9 @@ namespace MonoDevelop.VersionControl.Git return result; } - bool ProbablyIncorrect () + public override void Reset (URIish uri) { - // If we are queried multiple times in rapid succession it is probably - // because the supplied password is incorrect and we should dump it. - return (DateTime.Now - LastAsked) < TimeSpan.FromSeconds (2); + HasReset = true; } bool TryGetPassphrase (URIish uri, CredentialItem[] items, out CredentialItem.StringType passphraseItem) |