Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a Trust and Verification UI for the Profile Page that allows users to verify their identity using their UPI (University Personal Identifier). The feature includes Firebase integration to store verification codes and a backend API for handling the verification process.
- Adds comprehensive verification UI with UPI input and verification code handling
- Implements Firebase functions for storing UPI and generating verification codes
- Creates backend API endpoints for requesting and verifying codes with email integration
- Adds ProfileBadge variants to display verification status
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/ProfilePage.js | Adds verification UI with UPI input, code generation, and verification flow |
| frontend/src/firebase/firestore.js | Implements Firebase functions for UPI storage and verification code generation |
| frontend/src/components/ui/ProfileBadge.js | Adds success and danger variants for verification status display |
| backend/routes/verification.js | Creates verification API endpoints for code generation and validation |
| backend/package.json | Adds nodemailer dependency for email functionality |
| backend/index.js | Registers verification route endpoints |
| backend/email.js | Implements email service for sending verification codes |
| README.md | Minor formatting cleanup in tech stack section |
Files not reviewed (1)
- backend/package-lock.json: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| type="text" | ||
| inputMode="numeric" | ||
| pattern="[0-9]*" | ||
| maxLength={6} |
There was a problem hiding this comment.
Input maxLength is set to 6 but placeholder indicates '4-digit code'. This inconsistency could confuse users - either change maxLength to 4 or update placeholder to match the expected length.
| maxLength={6} | |
| maxLength={4} |
| function generateNumericCode(length = 6) { | ||
| const min = Math.pow(10, length - 1); | ||
| const max = Math.pow(10, length) - 1; | ||
| return String(Math.floor(Math.random() * (max - min + 1)) + min); | ||
| } |
There was a problem hiding this comment.
The generateNumericCode function defaults to 6 digits but is called with 4 digits on line 41. Consider removing the default parameter to make the length requirement explicit, or ensure consistency across the codebase.
| // Generate random 4-digit code | ||
| const code = Math.floor(1000 + Math.random() * 9000).toString(); |
There was a problem hiding this comment.
This code generation logic duplicates the backend's generateNumericCode function. Consider extracting this to a shared utility function or using a consistent approach across frontend and backend.
|
|
Will not be worked on for now |


📌 Description
This PR implements the Trust and Verification UI for the Profile Page as part of the UPI identity verification feature.
The verification process UI allows users to start the verification flow, receive a randomly generated verification code, and store it securely in Firebase.
What does this PR do?
Implements the frontend UI for user verification on the Profile Page and integrates Firebase logic to generate and store random verification codes.
Why is it needed?
This is part of the user identity verification flow (UPI integration) that enables the future Trust Badge feature for verified users.
It lays the groundwork for completing the full verification process in a later PR.
🔗 Related Issue(s)
Verification & Trust Systems #11
(Verification process is partially complete — UI and Firebase integration implemented, email sending not yet functional.)
✅ Changes
[✅] Bug fix
[✅] Feature implementation (UI + Firebase logic)
[✅] Documentation update
🧪 How to Test
Go to the Profile Page.
Locate the new Trust & Verification section.
Click the “Verify via UPI” or similar button.
Observe that a random verification code is generated and stored in Firebase under the user’s record.
Confirm that the code is displayed properly in the console/log (no real email will be sent).
Check that the UI updates appropriately when verification is initiated.