added re-login on refresh session fail

This commit is contained in:
Carson McManus 2016-12-25 19:19:51 -05:00
parent c53404ba94
commit fcc59a32e9

View file

@ -475,6 +475,24 @@ namespace SteamGuard
static void processConfirmations(SteamGuardAccount account) static void processConfirmations(SteamGuardAccount account)
{ {
if (Verbose) Console.WriteLine("Refeshing Session..."); if (Verbose) Console.WriteLine("Refeshing Session...");
if (account.RefreshSession())
{
if (Verbose) Console.WriteLine("Session refreshed");
}
else
{
if (Verbose) Console.WriteLine("Failed to refresh session");
Console.WriteLine("Your Steam credentials have expired. For trade and market confirmations to work properly, please login again.");
string username = account.AccountName;
Console.WriteLine($"Username: {username}");
Console.Write("Password: ");
var password = Console.ReadLine();
UserLogin login = new UserLogin(username, password);
Console.Write($"Logging in {username}... ");
LoginResult loginResult = login.DoLogin();
Console.WriteLine(loginResult);
if (account.RefreshSession()) if (account.RefreshSession())
{ {
if (Verbose) Console.WriteLine("Session refreshed"); if (Verbose) Console.WriteLine("Session refreshed");
@ -482,6 +500,8 @@ namespace SteamGuard
else else
{ {
Console.WriteLine("Failed to refresh session"); Console.WriteLine("Failed to refresh session");
return;
}
} }
Console.WriteLine("Retrieving trade confirmations..."); Console.WriteLine("Retrieving trade confirmations...");
var trades = account.FetchConfirmations(); var trades = account.FetchConfirmations();