chore: add example env file, improve documentation and code comments

This commit is contained in:
2025-08-23 00:27:01 -05:00
parent 5a29578c7d
commit cae3c892be
6 changed files with 35 additions and 25 deletions

View File

@@ -4,13 +4,13 @@ const fetch = require('node-fetch');
module.exports = {
formSecurityCheck: async (req, res, next) => {
// 1. Honeypot check (first line of defense)
// 1. Honeypot check
if (req.body.url) {
console.warn('Bot detected! Honeypot field was filled.');
return res.status(200).json({ success: true, message: 'Thank you for your submission.' });
}
// 2. hCaptcha verification (second line of defense)
// 2. hCaptcha verification
const hCaptchaResponse = req.body.hCaptchaResponse;
if (!hCaptchaResponse) {
return res.status(400).json({ success: false, message: 'CAPTCHA token missing.' });
@@ -36,7 +36,6 @@ module.exports = {
return res.status(400).json({ success: false, message: 'CAPTCHA verification failed. Please try again.' });
}
// If all checks pass, move to the next middleware or controller
next();
} catch (error) {