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
19
Program.cs
19
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);
|
||||||
|
string emailCode = null, twoFactorCode = null;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
login.EmailCode = emailCode;
|
||||||
|
login.TwoFactorCode = twoFactorCode;
|
||||||
Console.Write($"Logging in {username}... ");
|
Console.Write($"Logging in {username}... ");
|
||||||
LoginResult loginResult = login.DoLogin();
|
LoginResult loginResult = login.DoLogin();
|
||||||
Console.WriteLine(loginResult);
|
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;
|
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