|
27 | 27 | from supertokens_python.recipe.thirdparty.asyncio import (
|
28 | 28 | get_user_by_id as tp_get_user_by_idx,
|
29 | 29 | )
|
| 30 | +from supertokens_python.recipe.thirdpartyemailpassword import ( |
| 31 | + ThirdPartyEmailPasswordRecipe, |
| 32 | +) |
30 | 33 | from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
|
31 | 34 | get_user_by_id as tpep_get_user_by_id,
|
32 | 35 | )
|
| 36 | +from supertokens_python.recipe.thirdpartypasswordless import ( |
| 37 | + ThirdPartyPasswordlessRecipe, |
| 38 | +) |
33 | 39 | from supertokens_python.recipe.thirdpartypasswordless.asyncio import (
|
34 | 40 | get_user_by_id as tppless_get_user_by_id,
|
35 | 41 | )
|
@@ -324,3 +330,58 @@ async def update_user_dict(
|
324 | 330 | return GetUserForRecipeIdResult(user, recipe)
|
325 | 331 |
|
326 | 332 | return None
|
| 333 | + |
| 334 | + |
| 335 | +def is_recipe_initialised(recipeId: str) -> bool: |
| 336 | + isRecipeInitialised: bool = False |
| 337 | + |
| 338 | + if recipeId == EmailPasswordRecipe.recipe_id: |
| 339 | + try: |
| 340 | + EmailPasswordRecipe.get_instance() |
| 341 | + isRecipeInitialised = True |
| 342 | + except Exception: |
| 343 | + pass |
| 344 | + |
| 345 | + if not isRecipeInitialised: |
| 346 | + try: |
| 347 | + ThirdPartyEmailPasswordRecipe.get_instance() |
| 348 | + isRecipeInitialised = True |
| 349 | + except Exception: |
| 350 | + pass |
| 351 | + |
| 352 | + elif recipeId == PasswordlessRecipe.recipe_id: |
| 353 | + try: |
| 354 | + PasswordlessRecipe.get_instance() |
| 355 | + isRecipeInitialised = True |
| 356 | + except Exception: |
| 357 | + pass |
| 358 | + |
| 359 | + if not isRecipeInitialised: |
| 360 | + try: |
| 361 | + ThirdPartyPasswordlessRecipe.get_instance() |
| 362 | + isRecipeInitialised = True |
| 363 | + except Exception: |
| 364 | + pass |
| 365 | + |
| 366 | + elif recipeId == ThirdPartyRecipe.recipe_id: |
| 367 | + try: |
| 368 | + ThirdPartyRecipe.get_instance() |
| 369 | + isRecipeInitialised = True |
| 370 | + except Exception: |
| 371 | + pass |
| 372 | + |
| 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