Authored by htoooth

fix

... ... @@ -11,18 +11,18 @@ const {CAPTCHA_SWITCH, CAPTCHA_TYPE} = require('../models/captcha-type');
const isGeetest = (req) => {
return _.get(req.app.locals.pc, 'geetest.validation', false);
return _.get(req.session, 'captcha.type', '') === CAPTCHA_TYPE.geetest;
};
function required(req, res, next) {
img.trySwitch(req).then(() => {
if (isGeetest(req)) {
if (req.session.captcha.type === CAPTCHA_TYPE.image && req.session.captcha.value === CAPTCHA_SWITCH.off) {
const captcha = {
type: CAPTCHA_TYPE.geetest,
value: CAPTCHA_SWITCH.on
};
req.session.capthca = captcha;
req.session.captcha = captcha;
req.app.locals.captcha = captcha;
}
next();
... ...