|
@@ -10,6 +10,7 @@ const UserService = require('../models/user-service'); |
|
@@ -10,6 +10,7 @@ const UserService = require('../models/user-service'); |
10
|
const LoginService = require('../models/login-service');
|
10
|
const LoginService = require('../models/login-service');
|
11
|
const config = require('../../../config/common');
|
11
|
const config = require('../../../config/common');
|
12
|
const safeRedirect = require('../../../doraemon/middleware/safe-redirect').safeRedirect;
|
12
|
const safeRedirect = require('../../../doraemon/middleware/safe-redirect').safeRedirect;
|
|
|
13
|
+const captcha = require('./captcha');
|
13
|
|
14
|
|
14
|
let helpers = global.yoho.helpers;
|
15
|
let helpers = global.yoho.helpers;
|
15
|
let cache = global.yoho.cache;
|
16
|
let cache = global.yoho.cache;
|
|
@@ -156,7 +157,9 @@ let sendBindMsg = (req, res, next) => { |
|
@@ -156,7 +157,9 @@ let sendBindMsg = (req, res, next) => { |
156
|
// 检查是否检查过
|
157
|
// 检查是否检查过
|
157
|
// let checkNum = yield cache.get(`regCheckMobileNum_${mobile}`);
|
158
|
// let checkNum = yield cache.get(`regCheckMobileNum_${mobile}`);
|
158
|
|
159
|
|
159
|
- if (req.session.hasGetSMS) {
|
160
|
+ //检查上次的发送短信号码
|
|
|
161
|
+ if (captcha.checkSendMobile(req, res, true)) {
|
|
|
162
|
+ req.session.sendMobile = '';
|
160
|
data.message = '发送失败';
|
163
|
data.message = '发送失败';
|
161
|
return res.json(data);
|
164
|
return res.json(data);
|
162
|
}
|
165
|
}
|
|
@@ -176,7 +179,8 @@ let sendBindMsg = (req, res, next) => { |
|
@@ -176,7 +179,8 @@ let sendBindMsg = (req, res, next) => { |
176
|
|
179
|
|
177
|
return cache.set(sendCodeKey, sendCodeTimes + 1, 3600).then(() => {
|
180
|
return cache.set(sendCodeKey, sendCodeTimes + 1, 3600).then(() => {
|
178
|
if (result.code) {
|
181
|
if (result.code) {
|
179
|
- req.session.hasGetSMS = true;
|
182
|
+ //记录发送短信的号码
|
|
|
183
|
+ req.session.sendMobile = mobile;
|
180
|
return res.json(result);
|
184
|
return res.json(result);
|
181
|
} else {
|
185
|
} else {
|
182
|
data.message = '发送失败';
|
186
|
data.message = '发送失败';
|