From 529287246d1c3ab8eeae4bac61f6d57d047718db Mon Sep 17 00:00:00 2001 From: NolanTrem <34580718+NolanTrem@users.noreply.github.com> Date: Tue, 7 Jan 2025 00:48:12 -0800 Subject: [PATCH] Put email in data field --- js/sdk/src/v3/clients/users.ts | 5 ++++- py/core/main/api/v3/users_router.py | 14 +++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/js/sdk/src/v3/clients/users.ts b/js/sdk/src/v3/clients/users.ts index 47d1fc777..b4b075175 100644 --- a/js/sdk/src/v3/clients/users.ts +++ b/js/sdk/src/v3/clients/users.ts @@ -81,7 +81,10 @@ export class UsersClient { email: string; }): Promise { return this.client.makeRequest("POST", "users/send-verification-email", { - data: options, + data: `email=${encodeURIComponent(options.email)}`, + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, }); } diff --git a/py/core/main/api/v3/users_router.py b/py/core/main/api/v3/users_router.py index d40a336be..fb940ee6c 100644 --- a/py/core/main/api/v3/users_router.py +++ b/py/core/main/api/v3/users_router.py @@ -337,9 +337,8 @@ async def verify_email( from r2r import R2RClient client = R2RClient() - tokens = client.users.verify_email( + tokens = client.users.send_verification_email( email="jane.doe@example.com", - verification_code="1lklwal!awdclm" )""" ), }, @@ -352,9 +351,8 @@ async def verify_email( const client = new r2rClient(); function main() { - const response = await client.users.verifyEmail({ + const response = await client.users.sendVerificationEmail({ email: jane.doe@example.com", - verificationCode: "1lklwal!awdclm" }); } @@ -366,9 +364,9 @@ async def verify_email( "lang": "cURL", "source": textwrap.dedent( """ - curl -X POST "https://api.example.com/v3/users/login" \\ + curl -X POST "https://api.example.com/v3/users/send-verification-email" \\ -H "Content-Type: application/x-www-form-urlencoded" \\ - -d "email=jane.doe@example.com&verification_code=1lklwal!awdclm" + -d "email=jane.doe@example.com" """ ), }, @@ -391,9 +389,7 @@ async def send_verification_email( message="This email is already verified. Please log in.", ) - result = await self.services.auth.send_verification_email( - email=email - ) + await self.services.auth.send_verification_email(email=email) return GenericMessageResponse(message="A verification email has been sent.") # type: ignore @self.router.post(