Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset password and verification email to public routes #1766

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion js/sdk/src/v3/clients/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export class UsersClient {
email: string;
}): Promise<WrappedGenericMessageResponse> {
return this.client.makeRequest("POST", "users/send-verification-email", {
data: options,
data: `email=${encodeURIComponent(options.email)}`,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
}

Expand Down
14 changes: 5 additions & 9 deletions py/core/main/api/v3/users_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)"""
),
},
Expand All @@ -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"
});
}

Expand All @@ -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"
"""
),
},
Expand All @@ -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(
Expand Down
Loading