diff --git a/TwinpackShared/TwinpackServer.cs b/TwinpackShared/TwinpackServer.cs index fc13988..cf92cd2 100644 --- a/TwinpackShared/TwinpackServer.cs +++ b/TwinpackShared/TwinpackServer.cs @@ -14,6 +14,7 @@ using System.Reflection; using AdysTech.CredentialManager; using System.Threading; +using System.Net.PeerToPeer; namespace Twinpack { @@ -33,6 +34,13 @@ public class TwinpackServer public LoginPostResponse UserInfo { get; set; } public bool LoggedIn { get { return UserInfo?.User != null; } } + public TwinpackServer() + { + var credentials = CredentialManager.GetCredentials(TwinpackUrlBase); + Username = credentials?.UserName; + Password = credentials?.Password; + } + public Version ClientVersion { get @@ -414,6 +422,7 @@ public async Task PutPackageAsync(PackagePatchRequest packag public async Task LoginAsync(string username = null, string password = null, CancellationToken cancellationToken = default) { + _client.Invalidate(); // clear the cache var credentials = CredentialManager.GetCredentials(TwinpackUrlBase); var request = new HttpRequestMessage(HttpMethod.Post, new Uri(TwinpackUrl + "/login"));