...
|
...
|
@@ -29,14 +29,23 @@ const check = (req, res, next) => { |
|
|
co(function* () {
|
|
|
// 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码
|
|
|
if (req.path === '/passport/login/auth') {
|
|
|
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
|
|
|
// 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
|
|
|
let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
|
|
|
|
|
|
log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
|
|
|
log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
|
|
|
|
|
|
if (hasErrorLog) {
|
|
|
if (firstLoginShowCaptcha) {
|
|
|
req.yoho.captchaShow = true;
|
|
|
} else {
|
|
|
req.yoho.captchaShow = false;
|
|
|
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
|
|
|
|
|
|
log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
|
|
|
|
|
|
if (hasErrorLog) {
|
|
|
req.yoho.captchaShow = true;
|
|
|
} else {
|
|
|
req.yoho.captchaShow = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|