|
|
/**
|
|
|
* 短信controller
|
|
|
* @author: leo <qi.li@yoho.cn>
|
|
|
* @date: 2017/06/26
|
|
|
*/
|
|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const EventEmitter = require('events');
|
...
|
...
|
@@ -10,17 +15,14 @@ const ANONYMOUS_USER = '匿名用户'; |
|
|
const CODE_REQUIRED = '请输入校验码';
|
|
|
const GET_USER_INFO_FAILED = '获取用户信息失败';
|
|
|
|
|
|
// const BAD_PASSWORD = '密码格式不正确';
|
|
|
// const PASSWORD_REQUIRED = '请输入密码';
|
|
|
// const PASSWORD_LENGTH_ERROR = '密码6-20位,请重新输入';
|
|
|
|
|
|
/**
|
|
|
const sms = {
|
|
|
/**
|
|
|
* 发送短信验证码
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @returns {*|boolean}
|
|
|
*/
|
|
|
exports.send = (req, res) => {
|
|
|
send(req, res) {
|
|
|
const em = new EventEmitter();
|
|
|
const area = (req.body.area || '').trim();
|
|
|
const mobile = (req.body.mobile || '').trim();
|
...
|
...
|
@@ -59,9 +61,24 @@ exports.send = (req, res) => { |
|
|
code: 400,
|
|
|
message: '请填写手机号'
|
|
|
});
|
|
|
};
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 验证码校验
|
|
|
* @param req
|
|
|
* @param res
|
|
|
*/
|
|
|
check(req, res) {
|
|
|
console.log(req, res);
|
|
|
},
|
|
|
|
|
|
exports.login = (req, res, next) => {
|
|
|
/**
|
|
|
* 验证码登录
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @param next
|
|
|
*/
|
|
|
login(req, res, next) {
|
|
|
const code = (req.body.code || '').trim();
|
|
|
const area = _.get(req.session, 'smsLogin.area', '');
|
|
|
const mobile = _.get(req.session, 'smsLogin.mobile', '');
|
...
|
...
|
@@ -160,4 +177,7 @@ exports.login = (req, res, next) => { |
|
|
|
|
|
})
|
|
|
.catch(next);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
module.exports = sms; |
...
|
...
|
|