From 4d9d7227b3cfb2526e7949f2c3cb62a3da94c644 Mon Sep 17 00:00:00 2001 From: makcstudio Date: Thu, 19 Oct 2023 13:46:05 +0300 Subject: [PATCH] fixed relogin fixed relogin --- Steam Desktop Authenticator/LoginForm.cs | 58 +++++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/Steam Desktop Authenticator/LoginForm.cs b/Steam Desktop Authenticator/LoginForm.cs index 02f88fd..2c1ff13 100644 --- a/Steam Desktop Authenticator/LoginForm.cs +++ b/Steam Desktop Authenticator/LoginForm.cs @@ -60,7 +60,7 @@ private void btnSteamLogin_Click(object sender, EventArgs e) if (LoginReason == LoginType.Android) { - FinishExtract(username, password); + //FinishExtract(username, password); return; } else if (LoginReason == LoginType.Refresh) @@ -321,10 +321,22 @@ private async void RefreshLogin(string username, string password) LoginResult response = LoginResult.BadCredentials; - while ((response = mUserLogin.DoLogin()) != LoginResult.LoginOkay) + while ((response = mUserLogin.DoLoginV2()) != LoginResult.LoginOkay) { switch (response) { + case LoginResult.NeedEmail: + InputForm emailForm = new InputForm("Введите код, отправленный на ваш email:"); + emailForm.ShowDialog(); + if (emailForm.Canceled) + { + this.Close(); + return; + } + + mUserLogin.EmailCode = emailForm.txtBox.Text; + break; + case LoginResult.NeedCaptcha: CaptchaForm captchaForm = new CaptchaForm(mUserLogin.CaptchaGID); captchaForm.ShowDialog(); @@ -363,6 +375,48 @@ private async void RefreshLogin(string username, string password) } } + /*while ((response = mUserLogin.DoLogin()) != LoginResult.LoginOkay) + { + switch (response) + { + case LoginResult.NeedCaptcha: + CaptchaForm captchaForm = new CaptchaForm(mUserLogin.CaptchaGID); + captchaForm.ShowDialog(); + if (captchaForm.Canceled) + { + this.Close(); + return; + } + + mUserLogin.CaptchaText = captchaForm.CaptchaCode; + break; + + case LoginResult.Need2FA: + mUserLogin.TwoFactorCode = androidAccount.GenerateSteamGuardCodeForTime(steamTime); + break; + + case LoginResult.BadRSA: + MessageBox.Show("Error logging in: Steam вернул \"BadRSA\".", "Ошибка входа", MessageBoxButtons.OK, MessageBoxIcon.Error); + this.Close(); + return; + + case LoginResult.BadCredentials: + MessageBox.Show("Error logging in: Username or password некорректные.", "Ошибка входа", MessageBoxButtons.OK, MessageBoxIcon.Error); + this.Close(); + return; + + case LoginResult.TooManyFailedLogins: + MessageBox.Show("Error logging in: Слишком много неудачных попыток, попробуйте позже.", "Ошибка входа", MessageBoxButtons.OK, MessageBoxIcon.Error); + this.Close(); + return; + + case LoginResult.GeneralFailure: + MessageBox.Show("Error logging in: Steam вернул \"GeneralFailure\".", "Ошибка входа", MessageBoxButtons.OK, MessageBoxIcon.Error); + this.Close(); + return; + } + }*/ + androidAccount.Session = mUserLogin.Session; HandleManifest(man, true);