Skip to content

Commit 0322472

Browse files
committed
feat: last changes
1 parent b013a5d commit 0322472

File tree

6 files changed

+17
-37
lines changed

6 files changed

+17
-37
lines changed

supertokens_python/recipe/emailverification/asyncio/__init__.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def is_email_verified(
8282
)
8383

8484

85-
async def revoke_email_verification_token(
85+
async def revoke_email_verification_tokens(
8686
user_id: str,
8787
email: Optional[str] = None,
8888
user_context: Optional[Dict[str, Any]] = None,
@@ -130,16 +130,6 @@ async def unverify_email(
130130
)
131131

132132

133-
async def revoke_email_verification_tokens(
134-
user_id: str, email: str, user_context: Union[None, Dict[str, Any]] = None
135-
):
136-
if user_context is None:
137-
user_context = {}
138-
return await EmailVerificationRecipe.get_instance().recipe_implementation.revoke_email_verification_tokens(
139-
user_id, email, user_context
140-
)
141-
142-
143133
async def send_email(
144134
input_: EmailTemplateVars, user_context: Union[None, Dict[str, Any]] = None
145135
):

supertokens_python/recipe/emailverification/syncio/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ def revoke_email_verification_token(
5656
user_context: Optional[Dict[str, Any]] = None,
5757
):
5858
from supertokens_python.recipe.emailverification.asyncio import (
59-
revoke_email_verification_token,
59+
revoke_email_verification_tokens,
6060
)
6161

62-
return sync(revoke_email_verification_token(user_id, email, user_context))
62+
return sync(revoke_email_verification_tokens(user_id, email, user_context))
6363

6464

6565
def unverify_email(
66-
user_id: str, email: str, user_context: Union[None, Dict[str, Any]] = None
66+
user_id: str,
67+
email: Optional[str] = None,
68+
user_context: Union[None, Dict[str, Any]] = None,
6769
):
6870
from supertokens_python.recipe.emailverification.asyncio import is_email_verified
6971

supertokens_python/recipe/session/api/signout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def handle_signout_api(api_implementation: APIInterface, api_options: APIO
3131

3232
session = await api_options.recipe_implementation.get_session(
3333
request=api_options.request,
34-
anti_csrf_check=None, # TODO: What should I pass here?
34+
anti_csrf_check=None,
3535
session_required=False,
3636
user_context=user_context,
3737
)

supertokens_python/recipe/session/interfaces.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async def fetch_and_set_claim(
232232
self,
233233
session_handle: str,
234234
claim: SessionClaim[Any],
235-
user_context: Optional[Dict[str, Any]] = None,
235+
user_context: Dict[str, Any],
236236
) -> bool:
237237
pass
238238

@@ -242,7 +242,7 @@ async def set_claim_value(
242242
session_handle: str,
243243
claim: SessionClaim[_T],
244244
value: _T,
245-
user_context: Optional[Dict[str, Any]] = None,
245+
user_context: Dict[str, Any],
246246
) -> bool:
247247
pass
248248

@@ -251,7 +251,7 @@ async def get_claim_value(
251251
self,
252252
session_handle: str,
253253
claim: SessionClaim[Any],
254-
user_context: Optional[Dict[str, Any]] = None,
254+
user_context: Dict[str, Any],
255255
) -> Union[SessionDoesNotExistError, GetClaimValueOkResult[Any]]:
256256
pass
257257

@@ -260,7 +260,7 @@ async def remove_claim(
260260
self,
261261
session_handle: str,
262262
claim: SessionClaim[Any],
263-
user_context: Optional[Dict[str, Any]] = None,
263+
user_context: Dict[str, Any],
264264
) -> bool:
265265
pass
266266

supertokens_python/recipe/session/recipe_implementation.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -433,11 +433,8 @@ async def fetch_and_set_claim(
433433
self,
434434
session_handle: str,
435435
claim: SessionClaim[Any],
436-
user_context: Optional[Dict[str, Any]] = None,
436+
user_context: Dict[str, Any],
437437
) -> bool:
438-
if user_context is None:
439-
user_context = {}
440-
441438
session_info = await self.get_session_information(session_handle, user_context)
442439
if session_info is None:
443440
return False
@@ -454,11 +451,8 @@ async def set_claim_value(
454451
session_handle: str,
455452
claim: SessionClaim[Any],
456453
value: Any,
457-
user_context: Optional[Dict[str, Any]] = None,
454+
user_context: Dict[str, Any],
458455
):
459-
if user_context is None:
460-
user_context = {}
461-
462456
access_token_payload_update = claim.add_to_payload_({}, value, user_context)
463457
return await self.merge_into_access_token_payload(
464458
session_handle, access_token_payload_update, user_context
@@ -468,11 +462,8 @@ async def get_claim_value(
468462
self,
469463
session_handle: str,
470464
claim: SessionClaim[Any],
471-
user_context: Optional[Dict[str, Any]] = None,
465+
user_context: Dict[str, Any],
472466
) -> Union[SessionDoesNotExistError, GetClaimValueOkResult[Any]]:
473-
if user_context is None:
474-
user_context = {}
475-
476467
session_info = await self.get_session_information(session_handle, user_context)
477468
if session_info is None:
478469
return SessionDoesNotExistError()
@@ -495,11 +486,8 @@ async def remove_claim(
495486
self,
496487
session_handle: str,
497488
claim: SessionClaim[Any],
498-
user_context: Optional[Dict[str, Any]] = None,
489+
user_context: Dict[str, Any],
499490
) -> bool:
500-
if user_context is None:
501-
user_context = {}
502-
503491
access_token_payload = claim.remove_from_payload_by_merge_({}, user_context)
504492
return await self.merge_into_access_token_payload(
505493
session_handle, access_token_payload, user_context

tests/emailpassword/test_emailverify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from supertokens_python.recipe.emailverification.asyncio import (
2828
create_email_verification_token,
2929
is_email_verified,
30-
revoke_email_verification_token,
30+
revoke_email_verification_tokens,
3131
unverify_email,
3232
verify_email_using_token,
3333
)
@@ -1021,7 +1021,7 @@ async def test_the_generate_token_api_with_valid_input_and_then_remove_token(
10211021
user_id = dict_response["user"]["id"]
10221022

10231023
verify_token = await create_email_verification_token(user_id)
1024-
await revoke_email_verification_token(user_id)
1024+
await revoke_email_verification_tokens(user_id)
10251025

10261026
if isinstance(verify_token, CreateEmailVerificationTokenOkResult):
10271027
response = await verify_email_using_token(verify_token.token)

0 commit comments

Comments
 (0)