Authored by 陈峰

Merge branch 'feature/superpwd' into 'gray'

geetest增加超级密码



See merge request !400
... ... @@ -2,6 +2,7 @@
const _ = require('lodash');
const Geetest = require('geetest');
const logger = global.yoho.logger;
const config = global.yoho.config;
const captcha = new Geetest({
geetest_id: 'bce95d796bc3058615fdf2ec2c0aef29',
... ... @@ -26,7 +27,8 @@ const geetest = {
validate(req, res, next) {
let challenge = req.body.geetest_challenge,
validate = req.body.geetest_validate,
seccode = req.body.geetest_seccode;
seccode = req.body.geetest_seccode,
testCode = req.body.yohobuy;
let errRes = {
code: 400,
... ... @@ -35,6 +37,10 @@ const geetest = {
changeCaptcha: true
};
if (testCode === config.testCode) {
return next();
}
// 使用极验证
let useGeetest = !_.get(req.app.locals.wap, 'geetest.validation', false);
... ...
... ... @@ -37,6 +37,7 @@ class Validate {
}, (captchaObj) => {
this.captchaObj = captchaObj;
captchaObj.appendTo($('#js-img-check'));
$('#js-img-check').after('<input id="yohobuy" type="text" style="display:none;">');
this._atWorking = true;
$('#js-img-check').addClass('hide').addClass('popup');
});
... ... @@ -72,6 +73,9 @@ class Validate {
if (this.type === validType.IMG_CHECK) {
return this.imgCheck.getResults();
} else {
if ($('#yohobuy').val()) {
return '';
}
return new Promise((resolve) => {
$('#js-img-check').removeClass('hide');
this.captchaObj.onSuccess(() => {
... ...