Authored by targaryen

backend-handle

@@ -19,6 +19,9 @@ const geetest = { @@ -19,6 +19,9 @@ const geetest = {
19 // success: data.success 19 // success: data.success
20 // }; 20 // };
21 21
  22 + if (!data.success) {
  23 + req.session.useYohoCaptcha = true;
  24 + }
22 res.send(data); 25 res.send(data);
23 }).catch(next); 26 }).catch(next);
24 }, 27 },
@@ -23,6 +23,12 @@ const check = (req, res, next) => { @@ -23,6 +23,12 @@ const check = (req, res, next) => {
23 // 使用极验证 23 // 使用极验证
24 let useGeetest = !_.get(req.app.locals.wap, 'geetest.validation', false); 24 let useGeetest = !_.get(req.app.locals.wap, 'geetest.validation', false);
25 25
  26 + // 某次请求极验证调用注册失败,强制使用自有图形验证码
  27 + if (req.session.useYohoCaptcha) {
  28 + useGeetest = false;
  29 + req.session.useYohoCaptcha = false;
  30 + }
  31 +
26 return (useGeetest ? geetest : captcha).validate(req, res, next); 32 return (useGeetest ? geetest : captcha).validate(req, res, next);
27 }; 33 };
28 34