From e7a6b266bbab79369c949ff36212fbaa989e0ca5 Mon Sep 17 00:00:00 2001 From: Sambhav Saxena Date: Sat, 2 Dec 2023 11:56:04 +0530 Subject: [PATCH] update: added passphrase to validate certificate post requests --- backend/controllers/certificateController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/controllers/certificateController.js b/backend/controllers/certificateController.js index cd703a2..ad971c0 100644 --- a/backend/controllers/certificateController.js +++ b/backend/controllers/certificateController.js @@ -11,7 +11,10 @@ const getCertificate = asyncHandler(async (req, res) => { }); const CreateCertificate = asyncHandler(async (req, res) => { - const { cid, driveURL } = req.body; + const { cid, driveURL, passphrase } = req.body; + if (passphrase !== process.env.PASSPHRASE) { + res.status(401).json({ message: "Unauthorized!" }); + } if (!cid || !driveURL) { res.status(404).json({ message: "Please fill out all the fields!" }); }