Authored by htoooth

fix

... ... @@ -8,11 +8,17 @@ const captchaService = require('../models/captcha-service');
const helpers = global.yoho.helpers;
const CAPTCHA = 'yoho4946abcdef#$%&!@';
const request = require('request');
const logger = global.yoho.logger;
// 对比函数
const _mustEqual = (req) => {
return req.session.captcha && (req.body.verifyCode === req.session.captcha ||
let result = req.session.captcha && (req.body.verifyCode === req.session.captcha ||
req.body.verifyCode === CAPTCHA);
logger.info(`captcha auth [${result ? 'success' : 'fail'}]`,
`CLIENT [${req.body.verifyCode}] SERVER [${req.session.captcha}]`);
return result;
};
// 中间件
... ...