...
|
...
|
@@ -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, 'close.firstLoginShowCaptcha', false);
|
|
|
|
|
|
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
|
|
|
log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
|
|
|
|
|
|
if (hasErrorLog) {
|
|
|
req.yoho.captchaShow = true;
|
|
|
}
|
|
|
next();
|
|
|
})().catch(function(e) {
|
|
|
if (firstLoginShowCaptcha) {
|
|
|
req.yoho.captchaShow = true;
|
|
|
next();
|
|
|
});
|
|
|
return next();
|
|
|
} else {
|
|
|
co(function* () {
|
|
|
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
|
|
|
|
|
|
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();
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
exports.common = common;
|
...
|
...
|
|