Add support for remembering password (loginkey).

This commit is contained in:
Nicholas Hastings committed 2017-07-26 18:30:29 -04:00
1 parent 35aa666ea5
commit 6e4a764bb9
5 files changed
+18 -1

No files matched your search

+3
View File
@@ -20,6 +20,9 @@ namespace DepotDownloader
[ProtoMember(4, IsRequired = false)]
public System.Collections.Concurrent.ConcurrentDictionary<string, int> ContentServerPenalty { get; private set; }
[ProtoMember(5, IsRequired = false)]
public Dictionary<string, string> LoginKeys { get; private set; }
string FileName = null;
ConfigStore()
+2
View File
@@ -339,6 +339,8 @@ namespace DepotDownloader
{
Username = username,
Password = password,
ShouldRememberPassword = Config.RememberPassword,
LoginKey = ConfigStore.TheConfig.LoginKeys.ContainsKey(username) ? ConfigStore.TheConfig.LoginKeys[username] : null,
}
);
+2
View File
@@ -24,5 +24,7 @@ namespace DepotDownloader
public int MaxServers { get; set; }
public int MaxDownloads { get; set; }
public bool RememberPassword { get; set; }
}
}
+2 -1
View File
@@ -87,6 +87,7 @@ namespace DepotDownloader
string username = GetParameter<string>(args, "-username") ?? GetParameter<string>(args, "-user");
string password = GetParameter<string>(args, "-password") ?? GetParameter<string>(args, "-pass");
ContentDownloader.Config.RememberPassword = HasParameter(args, "-remember-password");
ContentDownloader.Config.InstallDirectory = GetParameter<string>(args, "-dir");
ContentDownloader.Config.DownloadAllPlatforms = HasParameter(args, "-all-platforms");
ContentDownloader.Config.VerifyAll = HasParameter(args, "-verify-all") || HasParameter(args, "-verify_all") || HasParameter(args, "-validate");
@@ -97,7 +98,7 @@ namespace DepotDownloader
ContentDownloader.Config.MaxServers = Math.Max(ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads);
if (username != null && password == null)
if (username != null && password == null && !ConfigStore.TheConfig.LoginKeys.ContainsKey(username))
{
Console.Write("Enter account password for \"{0}\": ", username);
password = Util.ReadPassword();
+9
View File
@@ -94,6 +94,7 @@ namespace DepotDownloader
this.callbacks.Subscribe<SteamUser.SessionTokenCallback>(SessionTokenCallback);
this.callbacks.Subscribe<SteamApps.LicenseListCallback>(LicenseListCallback);
this.callbacks.Subscribe<SteamUser.UpdateMachineAuthCallback>(UpdateMachineAuthCallback);
this.callbacks.Subscribe<SteamUser.LoginKeyCallback>(LoginKeyCallback);
Console.Write( "Connecting to Steam3..." );
@@ -563,6 +564,14 @@ namespace DepotDownloader
steamUser.SendMachineAuthResponse( authResponse );
}
private void LoginKeyCallback(SteamUser.LoginKeyCallback loginKey)
{
ConfigStore.TheConfig.LoginKeys[logonDetails.Username] = loginKey.LoginKey;
ConfigStore.Save();
steamUser.AcceptNewLoginKey(loginKey);
}
}
}