Authored by 郭成尧

firstLoginShowCaptcha-switch

... ... @@ -550,19 +550,29 @@ exports.loginShowCaptchaByIp = function(req, res, next) {
req.yoho.captchaShow = false;
}
co(function*() {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
// 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'open.firstLoginShowCaptcha', false);
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
if (firstLoginShowCaptcha) {
// 因撞库,每次都展示
req.yoho.captchaShow = true;
return next();
} else {
// 勿删,可能要改回来
co(function* () {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
if (hasErrorLog) {
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
if (hasErrorLog) {
req.yoho.captchaShow = true;
}
next();
})().catch(function(e) {
req.yoho.captchaShow = true;
}
next();
})().catch(function(e) {
req.yoho.captchaShow = true;
next();
});
next();
});
}
};
exports.common = common;
... ...