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
2020-08-21 11:11:36 +02:00

13 lines
432 B
JavaScript

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();
});
};