@@ -99,7 +99,7 @@ app.post("/approveRequest", async (req, res) => {
9999
100100 // 🏫 HEADER
101101 page . drawText ( "GSSSIETW" , {
102- x : 70 ,
102+ x : 250 ,
103103 y : 790 ,
104104 size : 22 ,
105105 font : titleFont
@@ -128,7 +128,7 @@ app.post("/approveRequest", async (req, res) => {
128128 const lineGap = 26 ;
129129
130130 const lines = [
131- `This is to certify that ${ student . name } ,` ,
131+ `This is to certify that ${ user . name } ,` ,
132132 `is a bonafide student of GSSSIETW College` ,
133133 `This ${ data . requestedType } , certificate is issued upon request for official purposes.`
134134 ] ;
@@ -161,7 +161,8 @@ app.post("/approveRequest", async (req, res) => {
161161 /* ===============================
162162 🔗 QR CODE (CERT ID ONLY)
163163 =============================== */
164- const verifyUrl = `https://verifix-backend-sffh.onrender.com/verifyCertificate/${ requestId } ` ;
164+ const verifyUrl = `https://verifix-be399.web.app/verify/${ requestId } ` ;
165+
165166 const qrDataUrl = await QRCode . toDataURL ( verifyUrl ) ;
166167 const qrBytes = Buffer . from ( qrDataUrl . split ( "," ) [ 1 ] , "base64" ) ;
167168 const qrImage = await pdf . embedPng ( qrBytes ) ;
@@ -226,25 +227,45 @@ app.post("/rejectRequest", async (req, res) => {
226227/* ======================================================
227228 4️⃣ VERIFICATION ROUTE
228229====================================================== */
230+ // ⚠️ Legacy / optional route (QR should NOT point here)
229231app . get ( "/verifyCertificate" , async ( req , res ) => {
230- try {
231- const { certId } = req . query ;
232- const snap = await db . collection ( "requests" ) . doc ( certId ) . get ( ) ;
233-
234- if ( ! snap . exists || snap . data ( ) . status !== "APPROVED" ) {
235- return res . send ( "<h1 style='color:red; text-align:center; margin-top:50px;'>❌ INVALID OR REVOKED CERTIFICATE</h1>" ) ;
236- }
237-
238- res . send ( `
239- <div style="text-align:center; margin-top:50px; font-family:sans-serif;">
240- <h1 style="color:green">✔ VERIFIED AUTHENTIC</h1>
241- <p>This certificate was issued to <b>${ snap . data ( ) . userEmail } </b> via VerifiX.</p>
242- <p>Document Type: ${ snap . data ( ) . requestedType } </p>
243- </div>
244- ` ) ;
245- } catch ( err ) {
246- res . status ( 500 ) . send ( "Verification error" ) ;
232+ try {
233+ const { certId } = req . query ;
234+
235+ if ( ! certId ) {
236+ return res . send ( `
237+ <h2 style="text-align:center;margin-top:50px;">
238+ Please use the official VerifiX verification portal.
239+ </h2>
240+ ` ) ;
247241 }
242+
243+ const snap = await db . collection ( "requests" ) . doc ( certId ) . get ( ) ;
244+
245+ if ( ! snap . exists || snap . data ( ) . status !== "APPROVED" ) {
246+ return res . send ( `
247+ <h1 style="color:red;text-align:center;margin-top:50px;">
248+ ❌ INVALID OR REVOKED CERTIFICATE
249+ </h1>
250+ ` ) ;
251+ }
252+
253+ const data = snap . data ( ) ;
254+
255+ res . send ( `
256+ <div style="text-align:center;margin-top:40px;font-family:sans-serif;">
257+ <h1 style="color:green">✔ VERIFIED AUTHENTIC</h1>
258+ <p><b>Certificate ID:</b> ${ certId } </p>
259+ <p><b>Issued To:</b> ${ data . student ?. name || data . userEmail } </p>
260+ <p><b>Document Type:</b> ${ data . requestedType } </p>
261+ <p style="margin-top:20px;">
262+ Please verify via the official portal for full details.
263+ </p>
264+ </div>
265+ ` ) ;
266+ } catch ( err ) {
267+ res . status ( 500 ) . send ( "Verification error" ) ;
268+ }
248269} ) ;
249270
250271const PORT = process . env . PORT || 10000 ;
0 commit comments