Email Verfication MicroService - #40
Merged
Merged
Conversation
…background queue processing
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Implements an OTP-based email verification flow during user registration, backed by Redis + BullMQ and delivered via the existing email worker. This aligns registration with Issue #21’s goal of validating emails before account creation.
Changes:
- Added backend
/users/send-otpand/users/verify-otpendpoints and required anemailVerificationTokenfor/users/register. - Updated the frontend registration flow to a 3-step process (basic info → OTP verify → profile completion).
- Updated the email service worker/templates to send OTP emails and a post-registration welcome email.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/app/register/page.tsx | Adds a 3-step registration UI with OTP send/verify and passes emailVerificationToken to registration. |
| backend/src/controllers/user.controllers.js | Implements OTP send/verify, enforces email verification token during registration, and queues welcome email. |
| backend/src/routes/user.routes.js | Exposes new OTP endpoints and refactors one route definition for consistency. |
| backend/src/utils/emailQueue.js | Exports a shared Redis client and updates BullMQ queue connection usage. |
| email-service/src/workers/emailWorker.js | Adds handling for send-otp and send-welcome jobs. |
| email-service/src/templates/otpTemplate.js | Introduces the OTP email HTML template. |
| email-service/src/templates/welcomeTemplate.js | Introduces the welcome email HTML template. |
| email-service/src/templates/verificationTemplate.js | Removes the old link-based verification email template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+101
to
+110
| // Decode the temporary token and verify it belongs to this email | ||
| const decoded = jwt.verify( | ||
| emailVerificationToken, | ||
| process.env.ACCESS_TOKEN_SECRET, | ||
| ); | ||
| if (decoded.email !== email) { | ||
| return res | ||
| .status(400) | ||
| .json({ message: "Invalid verification token for this email." }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #21