Skip to content

Commit 172bb1a

Browse files
authored
Handle missing MFA method in login process
Raise error if no valid MFA method is provided during login.
1 parent fb8e60e commit 172bb1a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

firstrade/account.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ def _handle_mfa(self):
261261
"t_token": self.t_token,
262262
}
263263
response = self.session.post(urls.verify_pin(), data=data)
264+
else:
265+
raise LoginResponseError("MFA required but no valid MFA method "
266+
"was provided (pin, email/phone, or mfa_secret).")
264267
self.login_json = response.json()
265268
if self.login_json["error"] == "":
266269
if self.pin or self.mfa_secret is not None:

0 commit comments

Comments
 (0)