Skip to content

Commit e16f262

Browse files
committed
fix: tenant_id param usage
1 parent 51544e0 commit e16f262

File tree

13 files changed

+39
-39
lines changed

13 files changed

+39
-39
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ async def handle_user_password_put(
7272
async def reset_password(
7373
form_fields: List[NormalisedFormField],
7474
create_reset_password_token: Callable[
75-
[str, Dict[str, Any]],
75+
[str, str, Dict[str, Any]],
7676
Awaitable[
7777
Union[CreateResetPasswordOkResult, CreateResetPasswordWrongUserIdError]
7878
],
7979
],
8080
reset_password_using_token: Callable[
81-
[str, str, Dict[str, Any]],
81+
[str, str, str, Dict[str, Any]],
8282
Awaitable[
8383
Union[
8484
ResetPasswordUsingTokenOkResult,
@@ -100,15 +100,18 @@ async def reset_password(
100100
password_validation_error
101101
)
102102

103-
password_reset_token = await create_reset_password_token(user_id, user_context)
103+
# TODO: Pass tenant id
104+
password_reset_token = await create_reset_password_token(
105+
"pass-tenant-id", user_id, user_context
106+
)
104107

105108
if isinstance(password_reset_token, CreateResetPasswordWrongUserIdError):
106109
# Techincally it can but its an edge case so we assume that it wont
107110
# UNKNOWN_USER_ID_ERROR
108111
raise Exception("Should never come here")
109112

110113
password_reset_response = await reset_password_using_token(
111-
password_reset_token.token, new_password, user_context
114+
"pass-tenant-id", password_reset_token.token, new_password, user_context
112115
)
113116

114117
if isinstance(

supertokens_python/recipe/emailpassword/api/signup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
)
2929

3030
from supertokens_python.exceptions import raise_bad_input_exception
31-
from supertokens_python.utils import default_user_context, send_200_response
31+
from supertokens_python.utils import send_200_response
3232

3333
from .utils import validate_form_fields_or_throw_error
3434

supertokens_python/recipe/emailpassword/recipe.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from __future__ import annotations
1515

1616
from os import environ
17-
from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional
17+
from typing import TYPE_CHECKING, Any, Dict, List, Union
1818

1919
from supertokens_python.ingredients.emaildelivery import EmailDeliveryIngredient
2020
from supertokens_python.ingredients.emaildelivery.types import EmailDeliveryConfig
@@ -188,23 +188,23 @@ async def handle_api_request(
188188
)
189189
if request_id == SIGNUP:
190190
return await handle_sign_up_api(
191-
tenant_id, self.api_implementation, api_options
191+
tenant_id, self.api_implementation, api_options, user_context
192192
)
193193
if request_id == SIGNIN:
194194
return await handle_sign_in_api(
195-
tenant_id, self.api_implementation, api_options
195+
tenant_id, self.api_implementation, api_options, user_context
196196
)
197197
if request_id == SIGNUP_EMAIL_EXISTS:
198198
return await handle_email_exists_api(
199-
tenant_id, self.api_implementation, api_options
199+
tenant_id, self.api_implementation, api_options, user_context
200200
)
201201
if request_id == USER_PASSWORD_RESET_TOKEN:
202202
return await handle_generate_password_reset_token_api(
203-
tenant_id, self.api_implementation, api_options
203+
tenant_id, self.api_implementation, api_options, user_context
204204
)
205205
if request_id == USER_PASSWORD_RESET:
206206
return await handle_password_reset_api(
207-
tenant_id, self.api_implementation, api_options
207+
tenant_id, self.api_implementation, api_options, user_context
208208
)
209209

210210
return None

supertokens_python/recipe/emailpassword/syncio/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
from ..interfaces import SignInOkResult, SignInWrongCredentialsError
1919
from ..types import EmailTemplateVars, User
20-
from ...multitenancy.constants import DEFAULT_TENANT_ID
2120

2221

2322
def update_email_or_password(

supertokens_python/recipe/thirdparty/interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ async def sign_in_up(
109109
async def get_provider(
110110
self,
111111
third_party_id: str,
112-
tenant_id: Optional[str],
113112
client_type: Optional[str],
113+
tenant_id: Optional[str],
114114
user_context: Dict[str, Any],
115115
) -> GetProviderOkResult:
116116
pass

supertokens_python/recipe/thirdparty/recipe_implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ async def manually_create_or_update_user(
176176
async def get_provider(
177177
self,
178178
third_party_id: str,
179-
tenant_id: Optional[str],
180179
client_type: Optional[str],
180+
tenant_id: Optional[str],
181181
user_context: Dict[str, Any],
182182
):
183183
mt_recipe = MultitenancyRecipe.get_instance()

supertokens_python/recipe/thirdpartyemailpassword/api/emailpassword_api_impementation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ def get_interface_impl(
6363
if not implementation.disable_sign_in_post:
6464

6565
async def sign_in_post(
66-
tenant_id: str,
6766
form_fields: List[FormField],
67+
tenant_id: str,
6868
api_options: APIOptions,
6969
user_context: Dict[str, Any],
7070
) -> Union[
7171
SignInPostOkResult, SignInPostWrongCredentialsError, GeneralErrorResponse
7272
]:
7373
result = await api_implementation.emailpassword_sign_in_post(
74-
tenant_id, form_fields, api_options, user_context
74+
form_fields, tenant_id, api_options, user_context
7575
)
7676
if isinstance(result, EmailPasswordSignInPostOkResult):
7777
return SignInPostOkResult(
@@ -90,15 +90,15 @@ async def sign_in_post(
9090
if not implementation.disable_sign_up_post:
9191

9292
async def sign_up_post(
93-
tenant_id: str,
9493
form_fields: List[FormField],
94+
tenant_id: str,
9595
api_options: APIOptions,
9696
user_context: Dict[str, Any],
9797
) -> Union[
9898
SignUpPostOkResult, SignUpPostEmailAlreadyExistsError, GeneralErrorResponse
9999
]:
100100
result = await api_implementation.emailpassword_sign_up_post(
101-
tenant_id, form_fields, api_options, user_context
101+
form_fields, tenant_id, api_options, user_context
102102
)
103103
if isinstance(result, EmailPasswordSignUpPostOkResult):
104104
return SignUpPostOkResult(

supertokens_python/recipe/thirdpartyemailpassword/api/implementation.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,31 @@ def __init__(self):
9696

9797
async def emailpassword_email_exists_get(
9898
self,
99-
tenant_id: str,
10099
email: str,
100+
tenant_id: str,
101101
api_options: EmailPasswordApiOptions,
102102
user_context: Dict[str, Any],
103103
) -> Union[EmailExistsGetOkResult, GeneralErrorResponse]:
104104
return await self.ep_email_exists_get(
105-
tenant_id, email, api_options, user_context
105+
email, tenant_id, api_options, user_context
106106
)
107107

108108
async def generate_password_reset_token_post(
109109
self,
110-
tenant_id: str,
111110
form_fields: List[FormField],
111+
tenant_id: str,
112112
api_options: EmailPasswordApiOptions,
113113
user_context: Dict[str, Any],
114114
) -> Union[GeneratePasswordResetTokenPostOkResult, GeneralErrorResponse]:
115115
return await self.ep_generate_password_reset_token_post(
116-
tenant_id, form_fields, api_options, user_context
116+
form_fields, tenant_id, api_options, user_context
117117
)
118118

119119
async def password_reset_post(
120120
self,
121-
tenant_id: str,
122121
form_fields: List[FormField],
123122
token: str,
123+
tenant_id: str,
124124
api_options: EmailPasswordApiOptions,
125125
user_context: Dict[str, Any],
126126
) -> Union[
@@ -129,7 +129,7 @@ async def password_reset_post(
129129
GeneralErrorResponse,
130130
]:
131131
return await self.ep_password_reset_post(
132-
tenant_id, form_fields, token, api_options, user_context
132+
form_fields, token, tenant_id, api_options, user_context
133133
)
134134

135135
async def thirdparty_sign_in_up_post(
@@ -169,8 +169,8 @@ async def thirdparty_sign_in_up_post(
169169

170170
async def emailpassword_sign_in_post(
171171
self,
172-
tenant_id: str,
173172
form_fields: List[FormField],
173+
tenant_id: str,
174174
api_options: EmailPasswordApiOptions,
175175
user_context: Dict[str, Any],
176176
) -> Union[
@@ -179,7 +179,7 @@ async def emailpassword_sign_in_post(
179179
GeneralErrorResponse,
180180
]:
181181
result = await self.ep_sign_in_post(
182-
tenant_id, form_fields, api_options, user_context
182+
form_fields, tenant_id, api_options, user_context
183183
)
184184
if isinstance(result, SignInPostOkResult):
185185
return EmailPasswordSignInPostOkResult(
@@ -196,8 +196,8 @@ async def emailpassword_sign_in_post(
196196

197197
async def emailpassword_sign_up_post(
198198
self,
199-
tenant_id: str,
200199
form_fields: List[FormField],
200+
tenant_id: str,
201201
api_options: EmailPasswordApiOptions,
202202
user_context: Dict[str, Any],
203203
) -> Union[
@@ -206,7 +206,7 @@ async def emailpassword_sign_up_post(
206206
GeneralErrorResponse,
207207
]:
208208
result = await self.ep_sign_up_post(
209-
tenant_id, form_fields, api_options, user_context
209+
form_fields, tenant_id, api_options, user_context
210210
)
211211
if isinstance(result, SignUpPostOkResult):
212212
return EmailPasswordSignUpPostOkResult(

supertokens_python/recipe/thirdpartyemailpassword/recipeimplementation/implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ async def create_reset_password_token(
320320

321321
async def reset_password_using_token(
322322
self,
323-
tenant_id: str,
324323
token: str,
325324
new_password: str,
325+
tenant_id: str,
326326
user_context: Dict[str, Any],
327327
) -> Union[
328328
ResetPasswordUsingTokenOkResult, ResetPasswordUsingTokenInvalidTokenError

supertokens_python/recipe/thirdpartyemailpassword/recipeimplementation/third_party_recipe_implementation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ async def get_user_by_id(
4848
)
4949

5050
async def get_users_by_email(
51-
self, email: str, tenant_id: str, user_context: Dict[str, Any]
51+
self, email: str, user_context: Dict[str, Any]
5252
) -> List[User]:
53+
# TODO: Pass tenant id here
5354
users = await self.recipe_implementation.get_users_by_email(
54-
email, tenant_id, user_context
55+
email, "pass-tenant-id", user_context
5556
)
5657
users_result: List[User] = []
5758

@@ -156,8 +157,8 @@ async def manually_create_or_update_user(
156157
async def get_provider(
157158
self,
158159
third_party_id: str,
159-
tenant_id: Optional[str],
160160
client_type: Optional[str],
161+
tenant_id: Optional[str],
161162
user_context: Dict[str, Any],
162163
) -> GetProviderOkResult:
163164
return await self.recipe_implementation.thirdparty_get_provider(

0 commit comments

Comments
 (0)