Skip to content

Feature/trust and varification#104

Closed
Minseo421 wants to merge 4 commits intoSofteng310:mainfrom
Minseo421:feature/trust-and-varification
Closed

Feature/trust and varification#104
Minseo421 wants to merge 4 commits intoSofteng310:mainfrom
Minseo421:feature/trust-and-varification

Conversation

@Minseo421
Copy link
Copy Markdown
Collaborator

📌 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.

⚠️ Note: The verification code is currently not sent via email, as email delivery integration has not yet been implemented. This PR focuses on the UI and Firebase integration layer only.

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.

Copilot AI review requested due to automatic review settings October 19, 2025 23:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
maxLength={6}
maxLength={4}

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +13
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);
}
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +422 to +423
// Generate random 4-digit code
const code = Math.floor(1000 + Math.random() * 9000).toString();
Copy link

Copilot AI Oct 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube Cloud

@Embers2512
Copy link
Copy Markdown
Collaborator

Will not be worked on for now

@Embers2512 Embers2512 closed this Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants