Skip to content

Commit a80b161

Browse files
committed
updated
1 parent 6ca2582 commit a80b161

7 files changed

Lines changed: 129 additions & 110 deletions

File tree

backend/server.js

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
229231
app.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

250271
const PORT = process.env.PORT || 10000;
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 82 additions & 82 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/dist/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>VerifiX</title>
7-
<script type="module" crossorigin src="/assets/index-CTLX1XmD.js"></script>
8-
<link rel="stylesheet" crossorigin href="/assets/index-DkxfDYSj.css">
7+
<script type="module" crossorigin src="/assets/index-DwAv8ZX7.js"></script>
8+
<link rel="stylesheet" crossorigin href="/assets/index-7m6w7HWX.css">
99
</head>
1010
<body>
1111
<div id="root"></div>

frontend/src/pages/MyRequests.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function MyRequests() {
6666
<th className="px-4">Type</th>
6767
<th className="px-4">Purpose</th>
6868
<th className="px-4">Status</th>
69-
<th className="px-4">AI Risk</th>
69+
<th className="px-4">Authenticity</th>
7070
<th className="px-4">Certificate</th>
7171
<th className="px-4">Action</th>
7272
</tr>

frontend/src/pages/Sidebar.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ export default function Sidebar({ role }) {
3838
Upload Document
3939
</NavLink>
4040

41-
<NavLink to="/student/certificates" className={navStyle}>
42-
My Certificates
43-
</NavLink>
41+
4442
</>
4543
)}
4644

frontend/src/pages/StudentDashboard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default function StudentDashboard() {
8181
Upload an existing document to detect forgery using AI forensics.
8282
</p>
8383
<Link
84-
to="/student/certificates"
84+
to="/student/requests"
8585
className="inline-block px-5 py-3 bg-[#1F3B2F] text-white rounded-lg hover:bg-[#163025]"
8686
>
8787
Verify Document →

0 commit comments

Comments
 (0)