Authored by htoooth

fix

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