chore: add example env file, improve documentation and code comments
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user