From 6e85255efc5f811271722208a95d98f30ab881d6 Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Sat, 20 Feb 2016 01:12:45 +0000 Subject: [PATCH] reworked auth_code_required event --- steam/client/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/steam/client/__init__.py b/steam/client/__init__.py index f1ac480..e64c236 100644 --- a/steam/client/__init__.py +++ b/steam/client/__init__.py @@ -89,10 +89,21 @@ class SteamClient(EventEmitter, FeatureBase): self.disconnect() if result in (EResult.AccountLogonDenied, + EResult.InvalidLoginAuthCode, EResult.AccountLoginDeniedNeedTwoFactor, EResult.TwoFactorCodeMismatch, ): - self.emit("auth_code_required", result) + + is_2fa = (result in (EResult.AccountLoginDeniedNeedTwoFactor, + EResult.TwoFactorCodeMismatch, + )) + + if is_2fa: + code_mismatch = (result == EResult.TwoFactorCodeMismatch) + else: + code_mismatch = (result == EResult.InvalidLoginAuthCode) + + self.emit("auth_code_required", is_2fa, code_mismatch) else: self.emit("error", result)