...
|
...
|
@@ -78,20 +78,19 @@ let checkMobile = (req, res, next) => { |
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
let picCaptcha = (req, res, next) => {
|
|
|
let picCaptcha = (req, res) => {
|
|
|
let verifyCode = _.trim(req.body.verifyCode);
|
|
|
let picFlag = true; // TODO: 图形验证码校验
|
|
|
|
|
|
if (picFlag) {
|
|
|
if (verifyCode !== req.session.captcha) {
|
|
|
return res.json({
|
|
|
code: 200,
|
|
|
message: '验证码正确'
|
|
|
code: 400,
|
|
|
message: '验证码错误'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return res.json({
|
|
|
code: 400,
|
|
|
message: '验证码错误'
|
|
|
code: 200,
|
|
|
message: '验证码正确'
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -104,7 +103,6 @@ let sendBindMsg = (req, res, next) => { |
|
|
|
|
|
let mobile = +req.body.mobile;
|
|
|
let area = +req.body.area;
|
|
|
let verifyCode = +req.body.verifyCode;
|
|
|
|
|
|
// 判断参数是否合法
|
|
|
if (!_.isNumber(mobile) || !_.isNumber(area)) {
|
...
|
...
|
@@ -112,6 +110,13 @@ let sendBindMsg = (req, res, next) => { |
|
|
return res.json(data);
|
|
|
}
|
|
|
|
|
|
let verifyCode = _.trim(req.body.verifyCode);
|
|
|
|
|
|
if (verifyCode !== req.session.captcha) {
|
|
|
data.message = '验证码不正确';
|
|
|
return res.json(data);
|
|
|
}
|
|
|
|
|
|
// 检查是否检查过
|
|
|
// let makeMobile = passportHelper.makeAreaMobile(area, mobile);
|
|
|
//
|
...
|
...
|
@@ -140,13 +145,6 @@ let sendBindMsg = (req, res, next) => { |
|
|
return res.json(data);
|
|
|
}
|
|
|
|
|
|
// TODO: 检测验证码不正确
|
|
|
// if (!PassportModel::verifyCode($verifyCode)) {
|
|
|
// $data['code'] = 400;
|
|
|
// $data['message'] = '图形验证码不正确';
|
|
|
// break;
|
|
|
// }
|
|
|
|
|
|
/* 向手机发送注册验证码 */
|
|
|
return regService.sendCodeToMobile(area, mobile).then((result) => {
|
|
|
return cache.set(sendCodeKey, sendCodeTimes + 1, 3600).then(() => {
|
...
|
...
|
@@ -212,12 +210,12 @@ let mobileRegister = (req, res, next) => { |
|
|
return res.json(data);
|
|
|
}
|
|
|
|
|
|
// TODO: 检测验证码不正确
|
|
|
// $verifyCode = strtolower(trim($this->post('verifyCode'))); //图形验证码
|
|
|
// if (!PassportModel::verifyCode($verifyCode)) {
|
|
|
// $data['message'] = '验证码不正确';
|
|
|
// break;
|
|
|
// }
|
|
|
let verifyCode = _.trim(req.body.verifyCode);
|
|
|
|
|
|
if (verifyCode !== req.session.captcha) {
|
|
|
data.message = '验证码不正确';
|
|
|
return res.json(data);
|
|
|
}
|
|
|
|
|
|
/* 判断密码是否符合规则 */
|
|
|
let code = +req.body.code; // 短信验证码
|
...
|
...
|
|