Authored by 毕凯

Merge branch 'hotfix/verifymodified' into 'master'

verify-switch



See merge request !883
@@ -29,14 +29,23 @@ const check = (req, res, next) => { @@ -29,14 +29,23 @@ const check = (req, res, next) => {
29 co(function* () { 29 co(function* () {
30 // 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码 30 // 如果是账号密码登录,那么需要检查是否登录失败过,登录失败过展示验证码
31 if (req.path === '/passport/login/auth') { 31 if (req.path === '/passport/login/auth') {
32 - let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`); 32 + // 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
  33 + let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
33 34
34 - log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog); 35 + log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
35 36
36 - if (hasErrorLog) { 37 + if (firstLoginShowCaptcha) {
37 req.yoho.captchaShow = true; 38 req.yoho.captchaShow = true;
38 } else { 39 } else {
39 - req.yoho.captchaShow = false; 40 + let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
  41 +
  42 + log.info(`Check clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
  43 +
  44 + if (hasErrorLog) {
  45 + req.yoho.captchaShow = true;
  46 + } else {
  47 + req.yoho.captchaShow = false;
  48 + }
40 } 49 }
41 } 50 }
42 51
@@ -60,6 +60,13 @@ @@ -60,6 +60,13 @@
60 } 60 }
61 61
62 setTimeout(function() { 62 setTimeout(function() {
  63 + {{#if @root.isLogin}}
  64 + {{#if @root.isApp}}
  65 + _hmt.push(['_setCustomVar', 3, 'login', 'APP', 2]);
  66 + {{^}}
  67 + _hmt.push(['_setCustomVar', 3, 'login', 'H5', 2]);
  68 + {{/if}}
  69 + {{/if}}
63 (function() { 70 (function() {
64 var hm = document.createElement("script"); 71 var hm = document.createElement("script");
65 hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; 72 hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
@@ -72,14 +79,6 @@ @@ -72,14 +79,6 @@
72 var s = document.getElementsByTagName("script")[0]; 79 var s = document.getElementsByTagName("script")[0];
73 s.parentNode.insertBefore(hm, s); 80 s.parentNode.insertBefore(hm, s);
74 })(); --}} 81 })(); --}}
75 -  
76 - {{#if @root.isLogin}}  
77 - {{#if @root.isApp}}  
78 - _hmt.push(['_setCustomVar', 3, 'login', 'APP', 2]);  
79 - {{^}}  
80 - _hmt.push(['_setCustomVar', 3, 'login', 'H5', 2]);  
81 - {{/if}}  
82 - {{/if}}  
83 }, 1000); 82 }, 1000);
84 }()); 83 }());
85 84