Add solvedCaptcha=true check also to blockbypass for the few routes which check block bypass w/o verifyCaptcha middleware before

indiachan-spamvector
Thomas Lynch 2 years ago
parent 65c06cc39e
commit 8061ffecb4
  1. 9
      lib/middleware/captcha/blockbypass.js

@ -5,7 +5,8 @@ const { Bypass } = require(__dirname+'/../../../db/')
, config = require(__dirname+'/../../misc/config.js')
, deleteTempFiles = require(__dirname+'/../../file/deletetempfiles.js')
, dynamicResponse = require(__dirname+'/../../misc/dynamic.js')
, production = process.env.NODE_ENV === 'production';
, production = process.env.NODE_ENV === 'production'
, Permissions = require(__dirname+'/../../permission/permissions.js');
module.exports = {
@ -13,6 +14,12 @@ module.exports = {
const { secureCookies, blockBypass } = config.get;
//bypass captcha permission
if (res.locals.permissions &&
res.locals.permissions.get(Permissions.BYPASS_CAPTCHA)) {
res.locals.solvedCaptcha = true;
}
//check if blockbypass exists and right length
const bypassId = req.signedCookies.bypassid;
if (!res.locals.solvedCaptcha && (!bypassId || bypassId.length !== 24)) {

Loading…
Cancel
Save