Allow login during setup using a provided email or 2FA code
This commit is contained in:
parent
7aa5e40d20
commit
bde0fe4ab3
1 changed files with 23 additions and 4 deletions
27
Program.cs
27
Program.cs
|
@ -325,10 +325,29 @@ namespace SteamGuard
|
||||||
var password = Console.ReadLine();
|
var password = Console.ReadLine();
|
||||||
|
|
||||||
UserLogin login = new UserLogin(username, password);
|
UserLogin login = new UserLogin(username, password);
|
||||||
Console.Write($"Logging in {username}... ");
|
string emailCode = null, twoFactorCode = null;
|
||||||
LoginResult loginResult = login.DoLogin();
|
while (true)
|
||||||
Console.WriteLine(loginResult);
|
{
|
||||||
if (!login.LoggedIn) return;
|
login.EmailCode = emailCode;
|
||||||
|
login.TwoFactorCode = twoFactorCode;
|
||||||
|
Console.Write($"Logging in {username}... ");
|
||||||
|
LoginResult loginResult = login.DoLogin();
|
||||||
|
Console.WriteLine(loginResult);
|
||||||
|
if (loginResult == LoginResult.NeedEmail)
|
||||||
|
{
|
||||||
|
Console.Write("Email code: ");
|
||||||
|
emailCode = Console.ReadLine();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (loginResult == LoginResult.Need2FA)
|
||||||
|
{
|
||||||
|
Console.Write("2FA code: ");
|
||||||
|
twoFactorCode = Console.ReadLine();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!login.LoggedIn) return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
AuthenticatorLinker linker = new AuthenticatorLinker(login.Session);
|
AuthenticatorLinker linker = new AuthenticatorLinker(login.Session);
|
||||||
AuthenticatorLinker.LinkResult linkResult = AuthenticatorLinker.LinkResult.GeneralFailure;
|
AuthenticatorLinker.LinkResult linkResult = AuthenticatorLinker.LinkResult.GeneralFailure;
|
||||||
|
|
Loading…
Reference in a new issue