5858
5959
6060async def update_email_for_recipe_id (
61- recipe_id : str , user_id : str , email : str , user_context : Dict [str , Any ]
61+ recipe_id : str ,
62+ user_id : str ,
63+ email : str ,
64+ tenant_id : str ,
65+ user_context : Dict [str , Any ],
6266) -> Union [
6367 UserPutAPIOkResponse ,
6468 UserPutAPIInvalidEmailErrorResponse ,
@@ -76,7 +80,7 @@ async def update_email_for_recipe_id(
7680 if form_field .id == FORM_FIELD_EMAIL_ID
7781 ]
7882
79- validation_error = await email_form_fields [0 ].validate (email )
83+ validation_error = await email_form_fields [0 ].validate (email , tenant_id )
8084
8185 if validation_error is not None :
8286 return UserPutAPIInvalidEmailErrorResponse (validation_error )
@@ -102,7 +106,7 @@ async def update_email_for_recipe_id(
102106 if form_field .id == FORM_FIELD_EMAIL_ID
103107 ]
104108
105- validation_error = await email_form_fields [0 ].validate (email )
109+ validation_error = await email_form_fields [0 ].validate (email , tenant_id )
106110
107111 if validation_error is not None :
108112 return UserPutAPIInvalidEmailErrorResponse (validation_error )
@@ -127,12 +131,14 @@ async def update_email_for_recipe_id(
127131 passwordless_config = PasswordlessRecipe .get_instance ().config .contact_config
128132
129133 if isinstance (passwordless_config .contact_method , ContactPhoneOnlyConfig ):
130- validation_error = await default_validate_email (email )
134+ validation_error = await default_validate_email (email , tenant_id )
131135
132136 elif isinstance (
133137 passwordless_config , (ContactEmailOnlyConfig , ContactEmailOrPhoneConfig )
134138 ):
135- validation_error = await passwordless_config .validate_email_address (email )
139+ validation_error = await passwordless_config .validate_email_address (
140+ email , tenant_id
141+ )
136142
137143 if validation_error is not None :
138144 return UserPutAPIInvalidEmailErrorResponse (validation_error )
@@ -157,11 +163,13 @@ async def update_email_for_recipe_id(
157163 )
158164
159165 if isinstance (passwordless_config , ContactPhoneOnlyConfig ):
160- validation_error = await default_validate_email (email )
166+ validation_error = await default_validate_email (email , tenant_id )
161167 elif isinstance (
162168 passwordless_config , (ContactEmailOnlyConfig , ContactEmailOrPhoneConfig )
163169 ):
164- validation_error = await passwordless_config .validate_email_address (email )
170+ validation_error = await passwordless_config .validate_email_address (
171+ email , tenant_id
172+ )
165173
166174 if validation_error is not None :
167175 return UserPutAPIInvalidEmailErrorResponse (validation_error )
@@ -183,7 +191,11 @@ async def update_email_for_recipe_id(
183191
184192
185193async def update_phone_for_recipe_id (
186- recipe_id : str , user_id : str , phone : str , user_context : Dict [str , Any ]
194+ recipe_id : str ,
195+ user_id : str ,
196+ phone : str ,
197+ tenant_id : str ,
198+ user_context : Dict [str , Any ],
187199) -> Union [
188200 UserPutAPIOkResponse ,
189201 UserPutAPIInvalidPhoneErrorResponse ,
@@ -197,11 +209,13 @@ async def update_phone_for_recipe_id(
197209 passwordless_config = PasswordlessRecipe .get_instance ().config .contact_config
198210
199211 if isinstance (passwordless_config , ContactEmailOnlyConfig ):
200- validation_error = await default_validate_phone_number (phone )
212+ validation_error = await default_validate_phone_number (phone , tenant_id )
201213 elif isinstance (
202214 passwordless_config , (ContactPhoneOnlyConfig , ContactEmailOrPhoneConfig )
203215 ):
204- validation_error = await passwordless_config .validate_phone_number (phone )
216+ validation_error = await passwordless_config .validate_phone_number (
217+ phone , tenant_id
218+ )
205219
206220 if validation_error is not None :
207221 return UserPutAPIInvalidPhoneErrorResponse (validation_error )
@@ -226,12 +240,14 @@ async def update_phone_for_recipe_id(
226240 )
227241
228242 if isinstance (passwordless_config , ContactEmailOnlyConfig ):
229- validation_error = await default_validate_phone_number (phone )
243+ validation_error = await default_validate_phone_number (phone , tenant_id )
230244
231245 elif isinstance (
232246 passwordless_config , (ContactPhoneOnlyConfig , ContactEmailOrPhoneConfig )
233247 ):
234- validation_error = await passwordless_config .validate_phone_number (phone )
248+ validation_error = await passwordless_config .validate_phone_number (
249+ phone , tenant_id
250+ )
235251
236252 if validation_error is not None :
237253 return UserPutAPIInvalidPhoneErrorResponse (validation_error )
@@ -254,7 +270,7 @@ async def update_phone_for_recipe_id(
254270
255271async def handle_user_put (
256272 _api_interface : APIInterface ,
257- _tenant_id : str ,
273+ tenant_id : str ,
258274 api_options : APIOptions ,
259275 user_context : Dict [str , Any ],
260276) -> Union [
@@ -337,15 +353,15 @@ async def handle_user_put(
337353
338354 if email != "" :
339355 email_update_response = await update_email_for_recipe_id (
340- user_response .recipe , user_id , email , user_context
356+ user_response .recipe , user_id , email , tenant_id , user_context
341357 )
342358
343359 if not isinstance (email_update_response , UserPutAPIOkResponse ):
344360 return email_update_response
345361
346362 if phone != "" :
347363 phone_update_response = await update_phone_for_recipe_id (
348- user_response .recipe , user_id , phone , user_context
364+ user_response .recipe , user_id , phone , tenant_id , user_context
349365 )
350366
351367 if not isinstance (phone_update_response , UserPutAPIOkResponse ):
0 commit comments