mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 14:10:53 +00:00
Closes #598
We can actually move asking for token into OnConnected() method, nicely putting it into login limiter instead of being executed on every connection attempt. This way we'll avoid executing this function on obvius network issues.
This commit is contained in:
@@ -826,11 +826,6 @@ namespace ArchiSteamFarm {
|
||||
|
||||
await LimitLoginRequestsAsync().ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) {
|
||||
// In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required
|
||||
TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!force && (!KeepRunning || SteamClient.IsConnected)) {
|
||||
return;
|
||||
}
|
||||
@@ -1340,7 +1335,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private void OnConnected(SteamClient.ConnectedCallback callback) {
|
||||
private async void OnConnected(SteamClient.ConnectedCallback callback) {
|
||||
if (callback == null) {
|
||||
ArchiLogger.LogNullError(nameof(callback));
|
||||
return;
|
||||
@@ -1393,6 +1388,11 @@ namespace ArchiSteamFarm {
|
||||
loginKey = CryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) {
|
||||
// In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required
|
||||
TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails {
|
||||
AuthCode = AuthCode,
|
||||
CellID = Program.GlobalDatabase.CellID,
|
||||
|
||||
Reference in New Issue
Block a user