Authored by ccbikai(👎🏻🍜)

每次都校验验证码

... ... @@ -211,7 +211,7 @@ const sendCodeToMobileAPI = (req, res, next) => {
if (verifyCode) {
let captcha = _.get(req, 'session.captcha');
logger.info(`验证码校验结果${verifyCode.toString() === captcha},user:${verifyCode};server:${captcha}`);
logger.info(`captcha validate result${verifyCode.toString() === captcha},user:${verifyCode};server:${captcha}`);
if ((captcha && verifyCode.toString() === captcha) || (testCode === config.testCode)) {
req.session.backupCaptch.verifyResult = true;
} else {
... ...
... ... @@ -97,7 +97,7 @@ const bind = {
if (verify) {
let captcha = _.get(req, 'session.captcha');
logger.info(`验证码校验结果${verify.toString() === captcha},user:${verify};server:${captcha}`);
logger.info(`captcha validate result${verify.toString() === captcha},user:${verify};server:${captcha}`);
if ((captcha && verify.toString() === captcha) || (testCode === config.testCode)) {
BindService.bindCheck(phoneNum, openId, sourceType, areaCode).then(result => {
let data = {
... ...
... ... @@ -113,11 +113,7 @@ const local = {
width750: true,
loginIndex: true, // 模板中使用JS的标识
useGeetest: _.get(req.app.locals.wap, 'geetest.validation', true), // 使用极验证
// captchaShow: _.get(req.session, 'login.errorCount') <= 0,
captchaShow: true, // 170306 因为暴力破解密码问题,要求每次都展示验证码
// 返回的URL链接
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
showHeaderImg: true, // 控制显示头部图片
isPassportPage: true, // 模板中模块标识
... ... @@ -167,13 +163,9 @@ const local = {
res.render('international', {
width750: true,
// 返回的URL链接
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
loginInternational: true, // 模板中使用JS的标识
useGeetest: _.get(req.app.locals.wap, 'geetest.validation', true), // 使用极验证
// captchaShow: _.get(req.session, 'login.errorCount') <= 0,
captchaShow: true, // 170306 因为暴力破解密码问题,要求每次都展示验证码
isPassportPage: true, // 模板中模块标识
headerText: '登录',
... ... @@ -181,25 +173,21 @@ const local = {
countrys: RegService.getAreaData(), // 地区信息列表
module: 'passport',
page: 'international',
title: '国际账号登录'
title: '国际账号登录',
loadJs: [
{
src: global.yoho.config.geetestJs
}
]
});
},
login: (req, res, next) => {
// 170306 因为暴力破解密码问题,要求每次都校验验证码
_.set(req.session, 'login.errorCount', 0);
let count = _.get(req.session, 'login.errorCount');
if (count == null) { // eslint-disable-line
_.set(req.session, 'login.errorCount', 3);
}
// 使用极验证
let useGeetest = _.get(req.app.locals.wap, 'geetest.validation', true);
// 有货自有验证码
if (count <= 0 && !useGeetest) {
// 关闭极验证的时候使用有货自有验证码
if (!useGeetest) {
let captchaInput = req.body.captcha;
let captchaCode = _.get(req.session, 'captcha');
let testCode = req.body.yohobuy;
... ... @@ -212,7 +200,7 @@ const local = {
captchaShow: true
};
logger.info(`验证码校验结果${captchaInput.toString() === captchaCode},user:${captchaInput};server:${captchaCode}`);
logger.info(`captcha validate result${captchaInput.toString() === captchaCode},user:${captchaInput};server:${captchaCode}`);
--req.session.captchaValidCount;
... ...
... ... @@ -142,7 +142,7 @@ let verifyMobile = (req, res, next) => {
req.session.captcha = null;
data.changeCaptcha = true;
}
logger.info(`验证码校验结果${captcha.toString() === diffCaptcha},user:${captcha};server:${diffCaptcha}`);
logger.info(`captcha validate result${captcha.toString() === diffCaptcha},user:${captcha};server:${diffCaptcha}`);
// error case: 验证码不匹配
if (!(captcha === diffCaptcha || testCode === config.testCode)) {
... ...
... ... @@ -229,7 +229,7 @@ exports.indexCheck = (req, res, next) => {
}
logger.info(`验证码校验结果${captcode.toString() === captcodeValid},user:${captcode};server:${captcodeValid}`);
logger.info(`captcha validate result${captcode.toString() === captcodeValid},user:${captcode};server:${captcodeValid}`);
// 验证
if ([area, mobile].some(val => val === '')) {
return em.emit('reject', Object.assign(errorData, { message: '请填写手机号'}));
... ...