Skip to content

Commit 07da54a

Browse files
authored
Merge branch 'feat/tp-rework' into fix/mt-dashboard
2 parents eec077a + 8a0ac5a commit 07da54a

File tree

11 files changed

+24
-73
lines changed

11 files changed

+24
-73
lines changed

supertokens_python/recipe/dashboard/api/userdetails/user_sessions_get.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ async def handle_sessions_get(
2626
if user_id is None:
2727
raise_bad_input_exception("Missing required parameter 'userId'")
2828

29+
# Passing tenant id as None sets fetch_across_all_tenants to True
30+
# which is what we want here.
2931
session_handles = await get_all_session_handles_for_user(
30-
user_id, tenant_id, user_context
32+
user_id, None, user_context
3133
)
3234
sessions: List[Optional[SessionInfo]] = [None for _ in session_handles]
3335

supertokens_python/recipe/emailpassword/asyncio/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
CreateResetPasswordWrongUserIdError,
2323
CreateResetPasswordLinkUknownUserIdError,
2424
CreateResetPasswordLinkOkResult,
25-
CreateResetPasswordEmailOkResult,
26-
CreateResetPasswordEmailUnknownUserIdError,
25+
SendResetPasswordEmailOkResult,
26+
SendResetPasswordEmailUnknownUserIdError,
2727
)
2828
from supertokens_python.recipe.emailpassword.utils import get_password_reset_link
2929
from supertokens_python.recipe.emailpassword.types import (
@@ -165,7 +165,7 @@ async def send_reset_password_email(
165165
):
166166
link = await create_reset_password_link(user_id, tenant_id, user_context)
167167
if isinstance(link, CreateResetPasswordLinkUknownUserIdError):
168-
return CreateResetPasswordEmailUnknownUserIdError()
168+
return SendResetPasswordEmailUnknownUserIdError()
169169

170170
user = await get_user_by_id(user_id, user_context)
171171
assert user is not None
@@ -179,4 +179,4 @@ async def send_reset_password_email(
179179
user_context,
180180
)
181181

182-
return CreateResetPasswordEmailOkResult()
182+
return SendResetPasswordEmailOkResult()

supertokens_python/recipe/emailpassword/interfaces.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ class CreateResetPasswordLinkUknownUserIdError:
6666
pass
6767

6868

69-
class CreateResetPasswordEmailOkResult:
69+
class SendResetPasswordEmailOkResult:
7070
pass
7171

7272

73-
class CreateResetPasswordEmailUnknownUserIdError:
73+
class SendResetPasswordEmailUnknownUserIdError:
7474
pass
7575

7676

supertokens_python/recipe/emailverification/recipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def callback():
230230
PostSTInitCallbacks.add_post_init_callback(callback)
231231

232232
return EmailVerificationRecipe.__instance
233-
return raise_general_exception(
233+
raise_general_exception(
234234
"Emailverification recipe has already been initialised. Please check your code for bugs."
235235
)
236236

supertokens_python/recipe/session/asyncio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ async def revoke_all_sessions_for_user(
441441

442442
async def get_all_session_handles_for_user(
443443
user_id: str,
444-
tenant_id: Optional[str],
444+
tenant_id: Optional[str] = None,
445445
user_context: Union[None, Dict[str, Any]] = None,
446446
) -> List[str]:
447447
if user_context is None:

supertokens_python/recipe/session/interfaces.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ async def revoke_all_sessions_for_user(
219219
self,
220220
user_id: str,
221221
tenant_id: str,
222-
revoke_across_all_tenants: Optional[bool],
222+
revoke_across_all_tenants: bool,
223223
user_context: Dict[str, Any],
224224
) -> List[str]:
225225
pass
@@ -229,7 +229,7 @@ async def get_all_session_handles_for_user(
229229
self,
230230
user_id: str,
231231
tenant_id: str,
232-
fetch_across_all_tenants: Optional[bool],
232+
fetch_across_all_tenants: bool,
233233
user_context: Dict[str, Any],
234234
) -> List[str]:
235235
pass

supertokens_python/recipe/session/recipe_implementation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ async def revoke_all_sessions_for_user(
330330
self,
331331
user_id: str,
332332
tenant_id: Optional[str],
333-
revoke_across_all_tenants: Optional[bool],
333+
revoke_across_all_tenants: bool,
334334
user_context: Dict[str, Any],
335335
) -> List[str]:
336336
return await session_functions.revoke_all_sessions_for_user(
@@ -341,7 +341,7 @@ async def get_all_session_handles_for_user(
341341
self,
342342
user_id: str,
343343
tenant_id: Optional[str],
344-
fetch_across_all_tenants: Optional[bool],
344+
fetch_across_all_tenants: bool,
345345
user_context: Dict[str, Any],
346346
) -> List[str]:
347347
return await session_functions.get_all_session_handles_for_user(

supertokens_python/recipe/session/session_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ async def revoke_all_sessions_for_user(
392392
recipe_implementation: RecipeImplementation,
393393
user_id: str,
394394
tenant_id: Optional[str],
395-
revoke_across_all_tenants: Optional[bool],
395+
revoke_across_all_tenants: bool,
396396
) -> List[str]:
397397
if tenant_id is None:
398398
tenant_id = DEFAULT_TENANT_ID
@@ -408,7 +408,7 @@ async def get_all_session_handles_for_user(
408408
recipe_implementation: RecipeImplementation,
409409
user_id: str,
410410
tenant_id: Optional[str],
411-
fetch_across_all_tenants: Optional[bool],
411+
fetch_across_all_tenants: bool,
412412
) -> List[str]:
413413
if tenant_id is None:
414414
tenant_id = DEFAULT_TENANT_ID

supertokens_python/recipe/thirdpartyemailpassword/asyncio/__init__.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
CreateResetPasswordWrongUserIdError,
2626
CreateResetPasswordLinkUknownUserIdError,
2727
CreateResetPasswordLinkOkResult,
28-
CreateResetPasswordEmailUnknownUserIdError,
29-
CreateResetPasswordEmailOkResult,
30-
RawUserInfoFromProvider,
28+
SendResetPasswordEmailUnknownUserIdError,
29+
SendResetPasswordEmailEmailOkResult
3130
)
3231
from supertokens_python.recipe.emailpassword.utils import get_password_reset_link
3332

@@ -63,29 +62,6 @@ async def get_user_by_third_party_info(
6362
)
6463

6564

66-
async def thirdparty_sign_in_up(
67-
third_party_id: str,
68-
third_party_user_id: str,
69-
email: str,
70-
oauth_tokens: Dict[str, Any],
71-
raw_user_info_from_provider: RawUserInfoFromProvider,
72-
tenant_id: Optional[str] = None,
73-
user_context: Optional[Dict[str, Any]] = None,
74-
):
75-
if user_context is None:
76-
user_context = {}
77-
78-
return await ThirdPartyEmailPasswordRecipe.get_instance().recipe_implementation.thirdparty_sign_in_up(
79-
third_party_id,
80-
third_party_user_id,
81-
email,
82-
oauth_tokens,
83-
raw_user_info_from_provider,
84-
tenant_id or DEFAULT_TENANT_ID,
85-
user_context,
86-
)
87-
88-
8965
async def thirdparty_manually_create_or_update_user(
9066
third_party_id: str,
9167
third_party_user_id: str,
@@ -245,7 +221,7 @@ async def send_reset_password_email(
245221
):
246222
link = await create_reset_password_link(user_id, tenant_id, user_context)
247223
if isinstance(link, CreateResetPasswordLinkUknownUserIdError):
248-
return CreateResetPasswordEmailUnknownUserIdError()
224+
return SendResetPasswordEmailUnknownUserIdError()
249225

250226
user = await get_user_by_id(user_id, user_context)
251227
assert user is not None
@@ -259,4 +235,4 @@ async def send_reset_password_email(
259235
user_context,
260236
)
261237

262-
return CreateResetPasswordEmailOkResult()
238+
return SendResetPasswordEmailEmailOkResult()

supertokens_python/recipe/thirdpartyemailpassword/interfaces.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
CreateResetPasswordLinkUknownUserIdError = (
2222
EPInterfaces.CreateResetPasswordLinkUknownUserIdError
2323
)
24-
CreateResetPasswordEmailOkResult = EPInterfaces.CreateResetPasswordEmailOkResult
25-
CreateResetPasswordEmailUnknownUserIdError = (
26-
EPInterfaces.CreateResetPasswordEmailUnknownUserIdError
24+
SendResetPasswordEmailEmailOkResult = EPInterfaces.SendResetPasswordEmailOkResult
25+
SendResetPasswordEmailUnknownUserIdError = (
26+
EPInterfaces.SendResetPasswordEmailUnknownUserIdError
2727
)
2828
EmailPasswordEmailExistsGetOkResult = EPInterfaces.EmailExistsGetOkResult
2929
GeneratePasswordResetTokenPostOkResult = (

supertokens_python/recipe/thirdpartyemailpassword/syncio/__init__.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from ..interfaces import (
2020
EmailPasswordSignInOkResult,
2121
EmailPasswordSignInWrongCredentialsError,
22-
RawUserInfoFromProvider,
2322
)
2423
from ..types import EmailTemplateVars, User
2524

@@ -49,32 +48,6 @@ def get_user_by_third_party_info(
4948
)
5049

5150

52-
def thirdparty_sign_in_up(
53-
third_party_id: str,
54-
third_party_user_id: str,
55-
email: str,
56-
oauth_tokens: Dict[str, Any],
57-
raw_user_info_from_provider: RawUserInfoFromProvider,
58-
tenant_id: Optional[str] = None,
59-
user_context: Optional[Dict[str, Any]] = None,
60-
):
61-
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import (
62-
thirdparty_sign_in_up,
63-
)
64-
65-
return sync(
66-
thirdparty_sign_in_up(
67-
third_party_id,
68-
third_party_user_id,
69-
email,
70-
oauth_tokens,
71-
raw_user_info_from_provider,
72-
tenant_id,
73-
user_context,
74-
)
75-
)
76-
77-
7851
def thirdparty_manually_create_or_update_user(
7952
third_party_id: str,
8053
third_party_user_id: str,

0 commit comments

Comments
 (0)