firstLoginShowCaptcha-switch
Showing
1 changed file
with
20 additions
and
10 deletions
@@ -550,19 +550,29 @@ exports.loginShowCaptchaByIp = function(req, res, next) { | @@ -550,19 +550,29 @@ exports.loginShowCaptchaByIp = function(req, res, next) { | ||
550 | req.yoho.captchaShow = false; | 550 | req.yoho.captchaShow = false; |
551 | } | 551 | } |
552 | 552 | ||
553 | - co(function*() { | ||
554 | - let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`); | 553 | + // 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示 |
554 | + let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'open.firstLoginShowCaptcha', false); | ||
555 | 555 | ||
556 | - log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog); | 556 | + if (firstLoginShowCaptcha) { |
557 | + // 因撞库,每次都展示 | ||
558 | + req.yoho.captchaShow = true; | ||
559 | + return next(); | ||
560 | + } else { | ||
561 | + // 勿删,可能要改回来 | ||
562 | + co(function* () { | ||
563 | + let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`); | ||
557 | 564 | ||
558 | - if (hasErrorLog) { | 565 | + log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog); |
566 | + | ||
567 | + if (hasErrorLog) { | ||
568 | + req.yoho.captchaShow = true; | ||
569 | + } | ||
570 | + next(); | ||
571 | + })().catch(function(e) { | ||
559 | req.yoho.captchaShow = true; | 572 | req.yoho.captchaShow = true; |
560 | - } | ||
561 | - next(); | ||
562 | - })().catch(function(e) { | ||
563 | - req.yoho.captchaShow = true; | ||
564 | - next(); | ||
565 | - }); | 573 | + next(); |
574 | + }); | ||
575 | + } | ||
566 | }; | 576 | }; |
567 | 577 | ||
568 | exports.common = common; | 578 | exports.common = common; |
-
Please register or login to post a comment