Showing
8 changed files
with
17 additions
and
6 deletions
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | const _ = require('lodash'); | 8 | const _ = require('lodash'); |
9 | 9 | ||
10 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
11 | +const config = global.yoho.config; | ||
11 | 12 | ||
12 | const service = require('../models/back-service'); | 13 | const service = require('../models/back-service'); |
13 | const captchaService = require('../models/captcha-service'); | 14 | const captchaService = require('../models/captcha-service'); |
@@ -196,6 +197,7 @@ const sendCodeToMobileAPI = (req, res, next) => { | @@ -196,6 +197,7 @@ const sendCodeToMobileAPI = (req, res, next) => { | ||
196 | let verifyCode = req.body.verifyCode || ''; | 197 | let verifyCode = req.body.verifyCode || ''; |
197 | let phoneNum = req.body.phoneNum || ''; | 198 | let phoneNum = req.body.phoneNum || ''; |
198 | let areaCode = req.body.areaCode || '86'; | 199 | let areaCode = req.body.areaCode || '86'; |
200 | + let testCode = req.body.yohobuy; | ||
199 | 201 | ||
200 | /* 如果设置了冻结时间,验证 */ | 202 | /* 如果设置了冻结时间,验证 */ |
201 | if (_.has(req.session, 'backupCaptch.timeout')) { | 203 | if (_.has(req.session, 'backupCaptch.timeout')) { |
@@ -221,7 +223,7 @@ const sendCodeToMobileAPI = (req, res, next) => { | @@ -221,7 +223,7 @@ const sendCodeToMobileAPI = (req, res, next) => { | ||
221 | if (verifyCode) { | 223 | if (verifyCode) { |
222 | let captcha = _.get(req, 'session.captcha'); | 224 | let captcha = _.get(req, 'session.captcha'); |
223 | 225 | ||
224 | - if (captcha && verifyCode.toString() === captcha) { | 226 | + if ((captcha && verifyCode.toString() === captcha) || (testCode === config.testCode)) { |
225 | req.session.backupCaptch.verifyResult = true; | 227 | req.session.backupCaptch.verifyResult = true; |
226 | } else { | 228 | } else { |
227 | let jsonData = { | 229 | let jsonData = { |
@@ -167,6 +167,7 @@ const local = { | @@ -167,6 +167,7 @@ const local = { | ||
167 | if (count <= 0) { | 167 | if (count <= 0) { |
168 | let captchaInput = req.body.captcha; | 168 | let captchaInput = req.body.captcha; |
169 | let captchaCode = _.get(req.session, 'captcha'); | 169 | let captchaCode = _.get(req.session, 'captcha'); |
170 | + let testCode = req.body.yohobuy; | ||
170 | 171 | ||
171 | let errorCount = _.get(req.session, 'captchaValidCount'); // 初始1次 + 后续4次, 同一个验证码 共5次 | 172 | let errorCount = _.get(req.session, 'captchaValidCount'); // 初始1次 + 后续4次, 同一个验证码 共5次 |
172 | 173 | ||
@@ -186,7 +187,7 @@ const local = { | @@ -186,7 +187,7 @@ const local = { | ||
186 | jsonData.changeCaptcha = true; | 187 | jsonData.changeCaptcha = true; |
187 | } | 188 | } |
188 | 189 | ||
189 | - if (!(captchaInput && captchaCode && captchaInput === captchaCode)) { | 190 | + if (!(captchaInput && captchaCode && captchaInput === captchaCode) || testCode !== config.testCode) { |
190 | res.json(jsonData); | 191 | res.json(jsonData); |
191 | 192 | ||
192 | return; | 193 | return; |
@@ -4,6 +4,7 @@ const _ = require('lodash'); | @@ -4,6 +4,7 @@ const _ = require('lodash'); | ||
4 | const moment = require('moment'); | 4 | const moment = require('moment'); |
5 | const helpers = global.yoho.helpers; | 5 | const helpers = global.yoho.helpers; |
6 | const cookie = global.yoho.cookie; | 6 | const cookie = global.yoho.cookie; |
7 | +const config = global.yoho.config; | ||
7 | const EventEmitter = require('events'); | 8 | const EventEmitter = require('events'); |
8 | const utils = require(global.utils); | 9 | const utils = require(global.utils); |
9 | const RegService = require('../models/reg-service'); | 10 | const RegService = require('../models/reg-service'); |
@@ -132,6 +133,7 @@ exports.indexCheck = (req, res, next) => { | @@ -132,6 +133,7 @@ exports.indexCheck = (req, res, next) => { | ||
132 | let mobile = req.body.mobile = (req.body.mobile || '').trim(); | 133 | let mobile = req.body.mobile = (req.body.mobile || '').trim(); |
133 | let captcode = (req.body.captcode || '').trim(); | 134 | let captcode = (req.body.captcode || '').trim(); |
134 | let captcodeValid = _.get(req.session, 'captcha'); | 135 | let captcodeValid = _.get(req.session, 'captcha'); |
136 | + let testCode = req.body.yohobuy; | ||
135 | 137 | ||
136 | let em = new EventEmitter(); | 138 | let em = new EventEmitter(); |
137 | 139 | ||
@@ -183,7 +185,7 @@ exports.indexCheck = (req, res, next) => { | @@ -183,7 +185,7 @@ exports.indexCheck = (req, res, next) => { | ||
183 | return em.emit('reject', Object.assign(errorData, { message: '请填写手机号'})); | 185 | return em.emit('reject', Object.assign(errorData, { message: '请填写手机号'})); |
184 | } else if (!captcode) { | 186 | } else if (!captcode) { |
185 | return em.emit('reject', Object.assign(errorData, {message: '请填写验证码'})); | 187 | return em.emit('reject', Object.assign(errorData, {message: '请填写验证码'})); |
186 | - } else if (!(captcodeValid && captcode === captcodeValid)) { | 188 | + } else if (!(captcodeValid && captcode === captcodeValid) || testCode !== config.testCode) { |
187 | return em.emit('reject', Object.assign(errorData, {message: '请将图片旋转到正确位置'})); | 189 | return em.emit('reject', Object.assign(errorData, {message: '请将图片旋转到正确位置'})); |
188 | } | 190 | } |
189 | 191 |
@@ -15,6 +15,7 @@ module.exports = { | @@ -15,6 +15,7 @@ module.exports = { | ||
15 | port: 6001, | 15 | port: 6001, |
16 | siteUrl: '//m.yohobuy.com', | 16 | siteUrl: '//m.yohobuy.com', |
17 | assetUrl: '//127.0.0.1:5001', | 17 | assetUrl: '//127.0.0.1:5001', |
18 | + testCode: 'yoho4946abcdef#$%&!@', | ||
18 | domains: { | 19 | domains: { |
19 | // api: 'http://api-test3.yohops.com:9999/', | 20 | // api: 'http://api-test3.yohops.com:9999/', |
20 | // service: 'http://service-test3.yohops.com:9999/', | 21 | // service: 'http://service-test3.yohops.com:9999/', |
@@ -12,4 +12,6 @@ | @@ -12,4 +12,6 @@ | ||
12 | <li class="img-check-pic" data-val="0" style="background-image:url('{{imgSrc}}');"></li> | 12 | <li class="img-check-pic" data-val="0" style="background-image:url('{{imgSrc}}');"></li> |
13 | </ul> | 13 | </ul> |
14 | </div> | 14 | </div> |
15 | + | ||
16 | + <input id="yohobuy" type="text" style="display:none;"> | ||
15 | </div> | 17 | </div> |
@@ -71,7 +71,8 @@ $btnNext.on('touchstart', function() { | @@ -71,7 +71,8 @@ $btnNext.on('touchstart', function() { | ||
71 | data: { | 71 | data: { |
72 | areaCode: area.replace('+', ''), | 72 | areaCode: area.replace('+', ''), |
73 | phoneNum: pn, | 73 | phoneNum: pn, |
74 | - verifyCode: verify | 74 | + verifyCode: verify, |
75 | + yohobuy: $('#yohobuy').val() | ||
75 | }, | 76 | }, |
76 | success: function(data) { | 77 | success: function(data) { |
77 | if (data.code === 200) { | 78 | if (data.code === 200) { |
@@ -111,7 +111,8 @@ $loginBtn.on('touchstart', function() { | @@ -111,7 +111,8 @@ $loginBtn.on('touchstart', function() { | ||
111 | if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) { | 111 | if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) { |
112 | let data = { | 112 | let data = { |
113 | account: acc, | 113 | account: acc, |
114 | - password: pwd | 114 | + password: pwd, |
115 | + yohobuy: $('#yohobuy').val() | ||
115 | }; | 116 | }; |
116 | 117 | ||
117 | if (imgCheck.atWorking) { | 118 | if (imgCheck.atWorking) { |
@@ -103,7 +103,8 @@ page = { | @@ -103,7 +103,8 @@ page = { | ||
103 | $.post('/passport/sms_login/step1_check', { | 103 | $.post('/passport/sms_login/step1_check', { |
104 | area: areaCode.replace('+', ''), | 104 | area: areaCode.replace('+', ''), |
105 | mobile: phone, | 105 | mobile: phone, |
106 | - captcode: captcha | 106 | + captcode: captcha, |
107 | + yohobuy: $('#yohobuy').val() | ||
107 | }) | 108 | }) |
108 | .done(function(data) { | 109 | .done(function(data) { |
109 | if (data.code === 200) { | 110 | if (data.code === 200) { |
-
Please register or login to post a comment