fixed issue #11

This commit is contained in:
Carson McManus 2016-12-27 21:58:12 -05:00
parent 6c190f0918
commit 2058cb7ecb

View file

@ -478,6 +478,7 @@ namespace SteamGuard
if (account.RefreshSession()) if (account.RefreshSession())
{ {
if (Verbose) Console.WriteLine("Session refreshed"); if (Verbose) Console.WriteLine("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
} }
else else
{ {
@ -493,6 +494,7 @@ namespace SteamGuard
LoginResult loginResult = login.DoLogin(); LoginResult loginResult = login.DoLogin();
if (loginResult == LoginResult.Need2FA && !string.IsNullOrEmpty(account.SharedSecret)) if (loginResult == LoginResult.Need2FA && !string.IsNullOrEmpty(account.SharedSecret))
{ {
// if we need a 2fa code, and we can generate it, generate a 2fa code and log in.
if (Verbose) Console.WriteLine(loginResult); if (Verbose) Console.WriteLine(loginResult);
TimeAligner.AlignTime(); TimeAligner.AlignTime();
login.TwoFactorCode = account.GenerateSteamGuardCode(); login.TwoFactorCode = account.GenerateSteamGuardCode();
@ -500,14 +502,19 @@ namespace SteamGuard
loginResult = login.DoLogin(); loginResult = login.DoLogin();
} }
Console.WriteLine(loginResult); Console.WriteLine(loginResult);
if (loginResult == LoginResult.LoginOkay)
{
account.Session = login.Session;
}
if (account.RefreshSession()) if (account.RefreshSession())
{ {
if (Verbose) Console.WriteLine("Session refreshed"); if (Verbose) Console.WriteLine("Session refreshed");
Manifest.SaveAccount(account, Manifest.Encrypted);
} }
else else
{ {
Console.WriteLine("Failed to refresh session"); Console.WriteLine("Failed to refresh session, aborting...");
return; return;
} }
} }