Skip to content

migration of otp based verification to twilio and ui improvements#71

Merged
T4RuN05 merged 1 commit into
mainfrom
otp
Jun 4, 2026
Merged

migration of otp based verification to twilio and ui improvements#71
T4RuN05 merged 1 commit into
mainfrom
otp

Conversation

@T4RuN05

@T4RuN05 T4RuN05 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 4, 2026 19:47
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@T4RuN05 is attempting to deploy a commit to the shreevathsa05's projects team on Vercel, but is not a member of this team. To resolve this issue, you can:

  • Make your repository public. Collaboration is free for open source and public repositories.
  • Upgrade to pro and add @T4RuN05 as a member. A Pro subscription is required to access Vercel's collaborative features.
    • If you're the owner of the team, click here to upgrade and add @T4RuN05 as a member.
    • If you're the user who initiated this build request, click here to request access.
    • If you're already a member of the shreevathsa05's projects team, make sure that your Vercel account is connected to your GitHub account.

To read more about collaboration on Vercel, click here.

@T4RuN05
T4RuN05 merged commit 1a430ec into main Jun 4, 2026
1 of 2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

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 migrates OTP-based survey participant verification away from Firebase to Twilio Verify, and refreshes the citizen UI (including pre-generated question audio playback with a visual “glow” indicator).

Changes:

  • Replace Firebase phone auth with Twilio Verify (backend) and update the citizen auth flow accordingly.
  • Add pre-generated audio playback for survey questions (via /speech/audio/...) and new UI styling for survey/home pages.
  • Update citizen theme colors and add CSS for an audio visualizer glow effect.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
frontend/citizen/vite.config.js Adds dev server port and proxy for /speech audio endpoints.
frontend/citizen/src/pages/SurveyPage.jsx Implements pre-generated audio playback and survey UI refinements.
frontend/citizen/src/pages/Home.jsx Updates active survey filtering and card UI.
frontend/citizen/src/index.css Switches to a light theme and adds audio glow CSS/animation.
frontend/citizen/src/config/firebase.js Removes Firebase client auth config.
frontend/citizen/src/components/survey/DynamicField.jsx Updates form control styling to match new UI.
frontend/citizen/src/components/survey/AuthModal.jsx Updates OTP flow to use backend/Twilio and adds dev-only bypass UI.
frontend/citizen/src/components/navigation/Navbar.jsx Adjusts navbar styling for new theme.
frontend/citizen/package.json Removes Firebase dependency and adds lucide-react.
frontend/citizen/package-lock.json Updates lockfile for dependency changes.
backend/main2/src/controllers/authController.js Migrates OTP send/verify from Firebase to Twilio Verify.
backend/main2/src/config/twilio.js Adds Twilio client initialization from env vars.
backend/main2/src/config/firebase.js Removes Firebase Admin initialization.
backend/main2/package.json Removes firebase-admin and adds twilio.
Files not reviewed (1)
  • frontend/citizen/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

frontend/citizen/src/pages/SurveyPage.jsx:7

  • AuthModal now uses pre-generated audio playback, but speak is still imported and unused in this file, which can fail lint/builds that treat unused imports as errors.
import { useEffect, useState, useRef } from "react";
import { useNavigate, useParams } from "react-router-dom";
import { Volume2 } from "lucide-react";
import DynamicField from "../components/survey/DynamicField";
import { shouldShowField } from "../utils/ConditionEvaluator";
import { BASE_URL, START_TIME } from "../constants";
import { speak } from "../utils/textToSpeech";

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to +93
const cleanupAudio = () => {
if (reqAnimRef.current) cancelAnimationFrame(reqAnimRef.current);
if (activeQuestionRef.current) {
activeQuestionRef.current.style.setProperty('--audio-intensity', '0');
}
};
Comment on lines 1 to 4
import { useNavigate } from "react-router-dom";
import { useEffect, useState } from "react";
import { Globe, Volume2 } from "lucide-react";
import { BASE_URL } from "../constants";
Comment on lines +28 to 29
const activeSurveys = surveys.filter((s) => s.status === "active");
console.log(activeSurveys);
Comment on lines +194 to +199
// Trigger Twilio OTP
const twilioServiceSid = process.env.TWILIO_VERIFY_SERVICE_SID;
if (twilioClient && twilioServiceSid) {
try {
await twilioClient.verify.v2.services(twilioServiceSid)
.verifications.create({ to: `+91${phoneToVerify}`, channel: 'sms' });
Comment on lines +235 to +249
// Verify OTP with Twilio
const twilioServiceSid = process.env.TWILIO_VERIFY_SERVICE_SID;
if (twilioClient && twilioServiceSid) {
try {
const verificationCheck = await twilioClient.verify.v2.services(twilioServiceSid)
.verificationChecks.create({ to: `+91${phoneToVerify}`, code: otp });

if (verificationCheck.status !== 'approved') {
throw new ApiError(401, "Invalid OTP code");
}
} catch (err) {
console.error("Twilio Check Error:", err);
throw new ApiError(401, "OTP Verification Failed");
}
}
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.

2 participants