added an automatic retry if LoginResult.Need2FA returned and account has shared secret

This commit is contained in:
Carson McManus 2016-12-25 19:29:58 -05:00
parent fcc59a32e9
commit 6c190f0918

View file

@ -491,6 +491,14 @@ namespace SteamGuard
UserLogin login = new UserLogin(username, password); UserLogin login = new UserLogin(username, password);
Console.Write($"Logging in {username}... "); Console.Write($"Logging in {username}... ");
LoginResult loginResult = login.DoLogin(); LoginResult loginResult = login.DoLogin();
if (loginResult == LoginResult.Need2FA && !string.IsNullOrEmpty(account.SharedSecret))
{
if (Verbose) Console.WriteLine(loginResult);
TimeAligner.AlignTime();
login.TwoFactorCode = account.GenerateSteamGuardCode();
if (Verbose) Console.Write($"Logging in {username}... ");
loginResult = login.DoLogin();
}
Console.WriteLine(loginResult); Console.WriteLine(loginResult);
if (account.RefreshSession()) if (account.RefreshSession())