Skip to content

Commit 24da5f7

Browse files
committed
fix: recover token flow not being able to find email
1 parent eaaf5f2 commit 24da5f7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

supertokens_python/recipe/webauthn/recipe_implementation.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,16 @@ async def register_options(
9393
has_email_input: bool = False
9494
has_recover_account_token_input: bool = False
9595

96-
if "email" in kwargs:
96+
if "email" in kwargs and kwargs.get("email") is not None:
9797
has_email_input = True
9898
kwargs_obj = DisplayNameEmailInput(
9999
email=kwargs["email"],
100100
display_name=kwargs.get("display_name"),
101101
)
102-
elif "recover_account_token" in kwargs:
102+
elif (
103+
"recover_account_token" in kwargs
104+
and kwargs.get("recover_account_token") is not None
105+
):
103106
has_recover_account_token_input = True
104107
kwargs_obj = RecoverAccountTokenInput(
105108
recover_account_token=kwargs["recover_account_token"],
@@ -134,6 +137,10 @@ async def register_options(
134137
if login_method.recipe_user_id.get_as_string() == user_id:
135138
email = login_method.email
136139
break
140+
else:
141+
raise Exception(
142+
"should never come here: Either `email` or `recover_aacount_token` should be specified"
143+
)
137144

138145
if email is None:
139146
return InvalidEmailErrorResponse(err="The email is missing")

0 commit comments

Comments
 (0)