Authored by htoooth

fix.robot

... ... @@ -14,7 +14,7 @@ const index = (req, res, next) => {
}).catch(next);
};
const check = captchaService.requiredAPI;
const check = captchaService.geeCheck;
const isHuman = (req, res) => {
let remoteIp = req.get('X-Forwarded-For') || req.ip;
... ...
... ... @@ -19,7 +19,7 @@ const activate = require(`${cRoot}/activate`); // 激活点击统计
const questionnaire = require(`${cRoot}/questionnaire`);
router.get('/ads', ads.jump);
router.get('/check', captcha.required, robot.index);
router.get('/check', captcha.geeOnly, robot.index);
router.post('/check', robot.check, robot.isHuman);
router.get('/material', auth, materialController.indexNew);
... ...
... ... @@ -42,11 +42,26 @@ const checkAPI = (req, res) => {
return (isGeetest(req) ? gee.checkAPI : img.checkAPI)(req, res);
};
const geeOnly = (req, res, next) => {
const captcha = {
type: CAPTCHA_TYPE.geetest,
value: CAPTCHA_SWITCH.on
};
req.session.capthca = captcha;
req.app.locals.captcha = captcha;
return next();
};
const geeCheck = gee.requiredAPI;
module.exports = {
requiredAPI,
required,
generate,
checkAPI,
CAPTCHA_SWITCH,
CAPTCHA_TYPE
CAPTCHA_TYPE,
geeOnly,
geeCheck
};
... ...
var $ = require('yoho-jquery'),
Captcha = require('../plugins/captcha');
// 一直是极验证码
var captcha = new Captcha('.captcha-wrap', {
checkURI: '/3party/check',
page: 'robot'
... ...