Skip to content

Commit 41de9d2

Browse files
doc: update docs for v0.30.3 tag
1 parent 596eaa5 commit 41de9d2

File tree

3 files changed

+28
-52
lines changed

3 files changed

+28
-52
lines changed

html/supertokens_python/constants.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
4343
from __future__ import annotations
4444

4545
SUPPORTED_CDI_VERSIONS = [&#34;5.3&#34;]
46-
VERSION = &#34;0.30.2&#34;
46+
VERSION = &#34;0.30.3&#34;
4747
TELEMETRY = &#34;/telemetry&#34;
4848
USER_COUNT = &#34;/users/count&#34;
4949
USER_DELETE = &#34;/user/remove&#34;

html/supertokens_python/recipe/webauthn/index.html

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ <h3>Class variables</h3>
958958
async def get_available_secondary_factor_ids(
959959
_: TenantConfig,
960960
) -&gt; List[str]:
961-
return [&#34;emailpassword&#34;]
961+
return [FactorIds.WEBAUTHN]
962962

963963
mfa_instance.add_func_to_get_all_available_secondary_factor_ids_from_other_recipes(
964964
GetAllAvailableSecondaryFactorIdsFromOtherRecipesFunc(
@@ -969,11 +969,11 @@ <h3>Class variables</h3>
969969
async def user_setup(user: User, _: Dict[str, Any]) -&gt; List[str]:
970970
for login_method in user.login_methods:
971971
# We don&#39;t check for tenantId here because if we find the user
972-
# with emailpassword loginMethod from different tenant, then
972+
# with webauthn loginMethod from different tenant, then
973973
# we assume the factor is setup for this user. And as part of factor
974974
# completion, we associate that loginMethod with the session&#39;s tenantId
975975
if login_method.recipe_id == self.recipe_id:
976-
return [&#34;emailpassword&#34;]
976+
return [FactorIds.WEBAUTHN]
977977

978978
return []
979979

@@ -1000,7 +1000,8 @@ <h3>Class variables</h3>
10001000

10011001
# We order the login methods based on `time_joined` (oldest first)
10021002
ordered_login_methods = sorted(
1003-
user.login_methods, key=lambda lm: lm.time_joined, reverse=True
1003+
user.login_methods,
1004+
key=lambda lm: lm.time_joined,
10041005
)
10051006
# We take the ones that belong to this recipe
10061007
recipe_ordered_login_methods = list(
@@ -1011,7 +1012,7 @@ <h3>Class variables</h3>
10111012
)
10121013

10131014
result: List[str] = []
1014-
if len(recipe_ordered_login_methods) == 0:
1015+
if len(recipe_ordered_login_methods) != 0:
10151016
# If there are login methods belonging to this recipe, the factor is set up
10161017
# In this case we only list email addresses that have a password associated with them
10171018

@@ -1060,14 +1061,14 @@ <h3>Class variables</h3>
10601061
# If there is at least one real email address linked to the user, we only suggest real addresses
10611062
result = [
10621063
lm.email
1063-
for lm in recipe_ordered_login_methods
1064+
for lm in ordered_login_methods
10641065
if lm.email is not None and not is_fake_email(lm.email)
10651066
]
10661067
else:
10671068
# Else we use the fake ones
10681069
result = [
10691070
lm.email
1070-
for lm in recipe_ordered_login_methods
1071+
for lm in ordered_login_methods
10711072
if lm.email is not None and is_fake_email(lm.email)
10721073
]
10731074

@@ -1090,17 +1091,8 @@ <h3>Class variables</h3>
10901091
if email != session_login_method.email
10911092
]
10921093

1093-
# If the list is empty we generate an email address to make the flow where the user is never asked for
1094-
# an email address easier to implement. In many cases when the user adds an email-password factor, they
1095-
# actually only want to add a password and do not care about the associated email address.
1096-
# Custom implementations can choose to ignore this, and ask the user for the email anyway.
1097-
if len(result) == 0:
1098-
result.append(
1099-
f&#34;{session_recipe_user_id.get_as_string()}@stfakeemail.supertokens.com&#34;
1100-
)
1101-
11021094
return GetEmailsForFactorOkResult(
1103-
factor_id_to_emails_map={&#34;emailpassword&#34;: result}
1095+
factor_id_to_emails_map={FactorIds.WEBAUTHN: result}
11041096
)
11051097

11061098
mfa_instance.add_func_to_get_emails_for_factor_from_other_recipes(

html/supertokens_python/recipe/webauthn/recipe.html

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
160160
async def get_available_secondary_factor_ids(
161161
_: TenantConfig,
162162
) -&gt; List[str]:
163-
return [&#34;emailpassword&#34;]
163+
return [FactorIds.WEBAUTHN]
164164

165165
mfa_instance.add_func_to_get_all_available_secondary_factor_ids_from_other_recipes(
166166
GetAllAvailableSecondaryFactorIdsFromOtherRecipesFunc(
@@ -171,11 +171,11 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
171171
async def user_setup(user: User, _: Dict[str, Any]) -&gt; List[str]:
172172
for login_method in user.login_methods:
173173
# We don&#39;t check for tenantId here because if we find the user
174-
# with emailpassword loginMethod from different tenant, then
174+
# with webauthn loginMethod from different tenant, then
175175
# we assume the factor is setup for this user. And as part of factor
176176
# completion, we associate that loginMethod with the session&#39;s tenantId
177177
if login_method.recipe_id == self.recipe_id:
178-
return [&#34;emailpassword&#34;]
178+
return [FactorIds.WEBAUTHN]
179179

180180
return []
181181

@@ -202,7 +202,8 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
202202

203203
# We order the login methods based on `time_joined` (oldest first)
204204
ordered_login_methods = sorted(
205-
user.login_methods, key=lambda lm: lm.time_joined, reverse=True
205+
user.login_methods,
206+
key=lambda lm: lm.time_joined,
206207
)
207208
# We take the ones that belong to this recipe
208209
recipe_ordered_login_methods = list(
@@ -213,7 +214,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
213214
)
214215

215216
result: List[str] = []
216-
if len(recipe_ordered_login_methods) == 0:
217+
if len(recipe_ordered_login_methods) != 0:
217218
# If there are login methods belonging to this recipe, the factor is set up
218219
# In this case we only list email addresses that have a password associated with them
219220

@@ -262,14 +263,14 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
262263
# If there is at least one real email address linked to the user, we only suggest real addresses
263264
result = [
264265
lm.email
265-
for lm in recipe_ordered_login_methods
266+
for lm in ordered_login_methods
266267
if lm.email is not None and not is_fake_email(lm.email)
267268
]
268269
else:
269270
# Else we use the fake ones
270271
result = [
271272
lm.email
272-
for lm in recipe_ordered_login_methods
273+
for lm in ordered_login_methods
273274
if lm.email is not None and is_fake_email(lm.email)
274275
]
275276

@@ -292,17 +293,8 @@ <h1 class="title">Module <code>supertokens_python.recipe.webauthn.recipe</code><
292293
if email != session_login_method.email
293294
]
294295

295-
# If the list is empty we generate an email address to make the flow where the user is never asked for
296-
# an email address easier to implement. In many cases when the user adds an email-password factor, they
297-
# actually only want to add a password and do not care about the associated email address.
298-
# Custom implementations can choose to ignore this, and ask the user for the email anyway.
299-
if len(result) == 0:
300-
result.append(
301-
f&#34;{session_recipe_user_id.get_as_string()}@stfakeemail.supertokens.com&#34;
302-
)
303-
304296
return GetEmailsForFactorOkResult(
305-
factor_id_to_emails_map={&#34;emailpassword&#34;: result}
297+
factor_id_to_emails_map={FactorIds.WEBAUTHN: result}
306298
)
307299

308300
mfa_instance.add_func_to_get_emails_for_factor_from_other_recipes(
@@ -559,7 +551,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
559551
async def get_available_secondary_factor_ids(
560552
_: TenantConfig,
561553
) -&gt; List[str]:
562-
return [&#34;emailpassword&#34;]
554+
return [FactorIds.WEBAUTHN]
563555

564556
mfa_instance.add_func_to_get_all_available_secondary_factor_ids_from_other_recipes(
565557
GetAllAvailableSecondaryFactorIdsFromOtherRecipesFunc(
@@ -570,11 +562,11 @@ <h2 class="section-title" id="header-classes">Classes</h2>
570562
async def user_setup(user: User, _: Dict[str, Any]) -&gt; List[str]:
571563
for login_method in user.login_methods:
572564
# We don&#39;t check for tenantId here because if we find the user
573-
# with emailpassword loginMethod from different tenant, then
565+
# with webauthn loginMethod from different tenant, then
574566
# we assume the factor is setup for this user. And as part of factor
575567
# completion, we associate that loginMethod with the session&#39;s tenantId
576568
if login_method.recipe_id == self.recipe_id:
577-
return [&#34;emailpassword&#34;]
569+
return [FactorIds.WEBAUTHN]
578570

579571
return []
580572

@@ -601,7 +593,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
601593

602594
# We order the login methods based on `time_joined` (oldest first)
603595
ordered_login_methods = sorted(
604-
user.login_methods, key=lambda lm: lm.time_joined, reverse=True
596+
user.login_methods,
597+
key=lambda lm: lm.time_joined,
605598
)
606599
# We take the ones that belong to this recipe
607600
recipe_ordered_login_methods = list(
@@ -612,7 +605,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
612605
)
613606

614607
result: List[str] = []
615-
if len(recipe_ordered_login_methods) == 0:
608+
if len(recipe_ordered_login_methods) != 0:
616609
# If there are login methods belonging to this recipe, the factor is set up
617610
# In this case we only list email addresses that have a password associated with them
618611

@@ -661,14 +654,14 @@ <h2 class="section-title" id="header-classes">Classes</h2>
661654
# If there is at least one real email address linked to the user, we only suggest real addresses
662655
result = [
663656
lm.email
664-
for lm in recipe_ordered_login_methods
657+
for lm in ordered_login_methods
665658
if lm.email is not None and not is_fake_email(lm.email)
666659
]
667660
else:
668661
# Else we use the fake ones
669662
result = [
670663
lm.email
671-
for lm in recipe_ordered_login_methods
664+
for lm in ordered_login_methods
672665
if lm.email is not None and is_fake_email(lm.email)
673666
]
674667

@@ -691,17 +684,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
691684
if email != session_login_method.email
692685
]
693686

694-
# If the list is empty we generate an email address to make the flow where the user is never asked for
695-
# an email address easier to implement. In many cases when the user adds an email-password factor, they
696-
# actually only want to add a password and do not care about the associated email address.
697-
# Custom implementations can choose to ignore this, and ask the user for the email anyway.
698-
if len(result) == 0:
699-
result.append(
700-
f&#34;{session_recipe_user_id.get_as_string()}@stfakeemail.supertokens.com&#34;
701-
)
702-
703687
return GetEmailsForFactorOkResult(
704-
factor_id_to_emails_map={&#34;emailpassword&#34;: result}
688+
factor_id_to_emails_map={FactorIds.WEBAUTHN: result}
705689
)
706690

707691
mfa_instance.add_func_to_get_emails_for_factor_from_other_recipes(

0 commit comments

Comments
 (0)