Skip to content

Commit fa5df3e

Browse files
committed
Coerce falsy mfaLastMethodUsed to "email"
If the key exists but is null/empty, .get() returns None instead of the default. Use `or "email"` to handle that case.
1 parent 473bec6 commit fa5df3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/garth/sso.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def login(
134134

135135
if resp_type == SSO_MFA_REQUIRED:
136136
mfa_info = resp_json.get("customerMfaInfo") or {}
137-
mfa_method = mfa_info.get("mfaLastMethodUsed", "email")
137+
mfa_method = mfa_info.get("mfaLastMethodUsed") or "email"
138138
if return_on_mfa or prompt_mfa is None:
139139
return "needs_mfa", {
140140
"login_params": login_params,

0 commit comments

Comments
 (0)