Archived
1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
SOD/middlewares/reCaptcha.js

14 lines
432 B
JavaScript
Raw Permalink Normal View History

2020-08-20 22:46:46 +02:00
let error = require("../routes/utils/error");
module.exports = (req, res, next) => {
if(req.app.locals.test)
return next();
req.app.get("recaptcha").middleware.verify(req, res, () => {
if (req.recaptcha.error)
error(req, res, "Strange behaviour detected !", 400,
req.app.get("env") !== "production" ? req.recaptcha.error : undefined);
else
next();
});
};