Skip to content

Commit 0063f0c

Browse files
committed
adding dev-v0.18.7 tag to this commit to ensure building
1 parent 1ad65b8 commit 0063f0c

File tree

1 file changed

+24
-60
lines changed
  • html/supertokens_python/recipe/dashboard

1 file changed

+24
-60
lines changed

html/supertokens_python/recipe/dashboard/utils.html

+24-60
Original file line numberDiff line numberDiff line change
@@ -337,58 +337,40 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.utils</code><
337337
recipe: Optional[str] = None
338338

339339
async def update_user_dict(
340-
get_user_func1: Callable[[str], Awaitable[GetUserResult]],
341-
get_user_func2: Callable[[str], Awaitable[GetUserResult]],
342-
recipe1: str,
343-
recipe2: str,
340+
get_user_funcs: List[Callable[[str], Awaitable[GetUserResult]]],
341+
recipes: List[str],
344342
):
345343
nonlocal user, user_id, recipe
346344

347-
try:
348-
recipe_user = await get_user_func1(user_id) # type: ignore
349-
350-
if recipe_user is not None:
351-
user = UserWithMetadata().from_dict(
352-
recipe_user.__dict__, first_name=&#34;&#34;, last_name=&#34;&#34;
353-
)
354-
recipe = recipe1
355-
except Exception:
356-
pass
357-
358-
if user is None:
345+
for get_user_func, recipe_id in zip(get_user_funcs, recipes):
359346
try:
360-
recipe_user = await get_user_func2(user_id)
347+
recipe_user = await get_user_func(user_id) # type: ignore
361348

362349
if recipe_user is not None:
363350
user = UserWithMetadata().from_dict(
364351
recipe_user.__dict__, first_name=&#34;&#34;, last_name=&#34;&#34;
365352
)
366-
recipe = recipe2
353+
recipe = recipe_id
354+
break
367355
except Exception:
368356
pass
369357

370358
if recipe_id == EmailPasswordRecipe.recipe_id:
371359
await update_user_dict(
372-
ep_get_user_by_id,
373-
tpep_get_user_by_id,
374-
&#34;emailpassword&#34;,
375-
&#34;thirdpartyemailpassword&#34;,
360+
[ep_get_user_by_id, tpep_get_user_by_id],
361+
[&#34;emailpassword&#34;, &#34;thirdpartyemailpassword&#34;],
376362
)
377363

378364
elif recipe_id == ThirdPartyRecipe.recipe_id:
379365
await update_user_dict(
380-
tp_get_user_by_idx,
381-
tpep_get_user_by_id,
382-
&#34;thirdparty&#34;,
383-
&#34;thirdpartyemailpassword&#34;,
366+
[tp_get_user_by_idx, tpep_get_user_by_id, tppless_get_user_by_id],
367+
[&#34;thirdparty&#34;, &#34;thirdpartyemailpassword&#34;, &#34;thirdpartypasswordless&#34;],
384368
)
385369

386370
elif recipe_id == PasswordlessRecipe.recipe_id:
387371
await update_user_dict(
388-
pless_get_user_by_id,
389-
tppless_get_user_by_id,
390-
&#34;passwordless&#34;,
391-
&#34;thirdpartypasswordless&#34;,
372+
[pless_get_user_by_id, tppless_get_user_by_id],
373+
[&#34;passwordless&#34;, &#34;thirdpartypasswordless&#34;],
392374
)
393375

394376
if user is not None and recipe is not None:
@@ -545,58 +527,40 @@ <h2 class="section-title" id="header-functions">Functions</h2>
545527
recipe: Optional[str] = None
546528

547529
async def update_user_dict(
548-
get_user_func1: Callable[[str], Awaitable[GetUserResult]],
549-
get_user_func2: Callable[[str], Awaitable[GetUserResult]],
550-
recipe1: str,
551-
recipe2: str,
530+
get_user_funcs: List[Callable[[str], Awaitable[GetUserResult]]],
531+
recipes: List[str],
552532
):
553533
nonlocal user, user_id, recipe
554534

555-
try:
556-
recipe_user = await get_user_func1(user_id) # type: ignore
557-
558-
if recipe_user is not None:
559-
user = UserWithMetadata().from_dict(
560-
recipe_user.__dict__, first_name=&#34;&#34;, last_name=&#34;&#34;
561-
)
562-
recipe = recipe1
563-
except Exception:
564-
pass
565-
566-
if user is None:
535+
for get_user_func, recipe_id in zip(get_user_funcs, recipes):
567536
try:
568-
recipe_user = await get_user_func2(user_id)
537+
recipe_user = await get_user_func(user_id) # type: ignore
569538

570539
if recipe_user is not None:
571540
user = UserWithMetadata().from_dict(
572541
recipe_user.__dict__, first_name=&#34;&#34;, last_name=&#34;&#34;
573542
)
574-
recipe = recipe2
543+
recipe = recipe_id
544+
break
575545
except Exception:
576546
pass
577547

578548
if recipe_id == EmailPasswordRecipe.recipe_id:
579549
await update_user_dict(
580-
ep_get_user_by_id,
581-
tpep_get_user_by_id,
582-
&#34;emailpassword&#34;,
583-
&#34;thirdpartyemailpassword&#34;,
550+
[ep_get_user_by_id, tpep_get_user_by_id],
551+
[&#34;emailpassword&#34;, &#34;thirdpartyemailpassword&#34;],
584552
)
585553

586554
elif recipe_id == ThirdPartyRecipe.recipe_id:
587555
await update_user_dict(
588-
tp_get_user_by_idx,
589-
tpep_get_user_by_id,
590-
&#34;thirdparty&#34;,
591-
&#34;thirdpartyemailpassword&#34;,
556+
[tp_get_user_by_idx, tpep_get_user_by_id, tppless_get_user_by_id],
557+
[&#34;thirdparty&#34;, &#34;thirdpartyemailpassword&#34;, &#34;thirdpartypasswordless&#34;],
592558
)
593559

594560
elif recipe_id == PasswordlessRecipe.recipe_id:
595561
await update_user_dict(
596-
pless_get_user_by_id,
597-
tppless_get_user_by_id,
598-
&#34;passwordless&#34;,
599-
&#34;thirdpartypasswordless&#34;,
562+
[pless_get_user_by_id, tppless_get_user_by_id],
563+
[&#34;passwordless&#34;, &#34;thirdpartypasswordless&#34;],
600564
)
601565

602566
if user is not None and recipe is not None:

0 commit comments

Comments
 (0)