ronflai
02/09/2023, 10:40 AMrp
02/09/2023, 10:43 AMronflai
02/09/2023, 11:01 AMrp
02/09/2023, 11:02 AMronflai
02/09/2023, 11:03 AMrp
02/09/2023, 11:06 AMronflai
02/09/2023, 11:09 AMporcellus
02/09/2023, 12:09 PMpy
from supertokens_python import init, InputAppInfo
from supertokens_python.recipe import passwordless
from supertokens_python.recipe.passwordless.interfaces import CreateCodeOkResult
from supertokens_python.recipe.passwordless.interfaces import RecipeInterface
from typing import Union, Dict, Any
def override_passwordless_functions(original_implementation: RecipeInterface):
original_create_code = original_implementation.create_code
async def create_code(
email: Union[None, str],
phone_number: Union[None, str],
user_input_code: Union[None, str],
user_context: Dict[str, Any],
) -> CreateCodeOkResult:
await original_implementation.revoke_all_codes(email, phone_number, user_context)
return await original_create_code(email, phone_number, user_input_code, user_context)
original_implementation.create_code = create_code
return original_implementation
init(
app_info=InputAppInfo(api_domain="...", app_name="...", website_domain="..."),
framework='...',
recipe_list=[
passwordless.init(
contact_config=...,
flow_type="...",
override=passwordless.InputOverrideConfig(
functions=override_passwordless_functions
)
)
]
)
revoke_all_codes
when the user is starting a new login attempt.