Skip to content

Commit 7451922

Browse files
committed
Changes based on PR review
1 parent 00355e2 commit 7451922

File tree

1 file changed

+43
-7
lines changed
  • supertokens_python/recipe/dashboard

1 file changed

+43
-7
lines changed

supertokens_python/recipe/dashboard/utils.py

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@
2727
from supertokens_python.recipe.thirdparty.asyncio import (
2828
get_user_by_id as tp_get_user_by_idx,
2929
)
30+
from supertokens_python.recipe.thirdpartyemailpassword import (
31+
ThirdPartyEmailPasswordRecipe,
32+
)
3033
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
3134
get_user_by_id as tpep_get_user_by_id,
3235
)
36+
from supertokens_python.recipe.thirdpartypasswordless import (
37+
ThirdPartyPasswordlessRecipe,
38+
)
3339
from supertokens_python.recipe.thirdpartypasswordless.asyncio import (
3440
get_user_by_id as tppless_get_user_by_id,
3541
)
@@ -327,25 +333,55 @@ async def update_user_dict(
327333

328334

329335
def is_recipe_initialised(recipeId: str) -> bool:
336+
isRecipeInitialised: bool = False
337+
330338
if recipeId == EmailPasswordRecipe.recipe_id:
331339
try:
332340
EmailPasswordRecipe.get_instance()
333-
return True
341+
isRecipeInitialised = True
334342
except Exception:
335-
return False
343+
pass
344+
345+
if not isRecipeInitialised:
346+
try:
347+
ThirdPartyEmailPasswordRecipe.get_instance()
348+
isRecipeInitialised = True
349+
except Exception:
350+
pass
336351

337352
elif recipeId == PasswordlessRecipe.recipe_id:
338353
try:
339354
PasswordlessRecipe.get_instance()
340-
return True
355+
isRecipeInitialised = True
341356
except Exception:
342-
return False
357+
pass
358+
359+
if not isRecipeInitialised:
360+
try:
361+
ThirdPartyPasswordlessRecipe.get_instance()
362+
isRecipeInitialised = True
363+
except Exception:
364+
pass
343365

344366
elif recipeId == ThirdPartyRecipe.recipe_id:
345367
try:
346368
ThirdPartyRecipe.get_instance()
347-
return True
369+
isRecipeInitialised = True
348370
except Exception:
349-
return False
371+
pass
350372

351-
return False
373+
if not isRecipeInitialised:
374+
try:
375+
ThirdPartyEmailPasswordRecipe.get_instance()
376+
isRecipeInitialised = True
377+
except Exception:
378+
pass
379+
380+
if not isRecipeInitialised:
381+
try:
382+
ThirdPartyPasswordlessRecipe.get_instance()
383+
isRecipeInitialised = True
384+
except Exception:
385+
pass
386+
387+
return isRecipeInitialised

0 commit comments

Comments
 (0)