...
|
...
|
@@ -48,7 +48,7 @@ const validateInputAPI = (req, res, next) => { |
|
|
/**
|
|
|
* 校验用户输入信息,是否是已经注册的用户
|
|
|
*/
|
|
|
const validateUserPage = (req, res, next) => {
|
|
|
const validateInputPage = (req, res, next) => {
|
|
|
let userInput = req.body.phoneNum || '';
|
|
|
let areaCode = (req.body.area || '86').replace('+', '');
|
|
|
|
...
|
...
|
@@ -78,6 +78,7 @@ const sendCodePage = (req, res, next) => { |
|
|
service.sendCodeToUserAsync(inputInfo.type, inputInfo.phone, inputInfo.area)
|
|
|
.then(result => {
|
|
|
if (!(result.code && result.code === 200)) {
|
|
|
console.log(result);
|
|
|
return res.redirect(helpers.urlFormat('/passport/back/index'));
|
|
|
}
|
|
|
|
...
|
...
|
@@ -98,6 +99,7 @@ const saveInSession = (req, res) => { |
|
|
{
|
|
|
req.session.mobile = req.inputInfo.phone;
|
|
|
req.session.area = req.inputInfo.area;
|
|
|
req.session.verifyCode = req.session.captcha;
|
|
|
res.redirect(helpers.urlFormat('/passport/back/verification'));
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -138,9 +140,9 @@ const validateEmailInSession = (req, res, next) => { |
|
|
return res.redirect(helpers.urlFormat('/passport/back/index'));
|
|
|
}
|
|
|
|
|
|
let isp = email.split('@')[1];
|
|
|
let isp = email.split('@')[1].toLowerCase();
|
|
|
const mapperEmailISP = {
|
|
|
'yoho.cn': 'http://smail.yoho.cn'
|
|
|
'yoho.cn': 'http://exmail.qq.com/login'
|
|
|
};
|
|
|
|
|
|
req.body.emailUrl = mapperEmailISP[isp] || `http://mail.${isp}`;
|
...
|
...
|
@@ -254,9 +256,9 @@ const resetPwdSuccessPage = (req, res, next) => { |
|
|
};
|
|
|
|
|
|
const verifyCodeByMobileAPI = (req, res) => {
|
|
|
let mobile = req.param('mobile', '');
|
|
|
let area = req.param('area', '86');
|
|
|
let mobileCode = req.param('code', '');
|
|
|
let mobile = req.body.mobile || '';
|
|
|
let area = req.body.area || '86';
|
|
|
let mobileCode = req.body.code || '';
|
|
|
const ERR = {
|
|
|
code: 400,
|
|
|
message: '验证码错误!',
|
...
|
...
|
@@ -279,7 +281,6 @@ const verifyCodeByMobileAPI = (req, res) => { |
|
|
};
|
|
|
|
|
|
const validateExistCodePage = (req, res, next) => {
|
|
|
|
|
|
let code = req.query.code || req.body.code;
|
|
|
|
|
|
if (!code) {
|
...
|
...
|
@@ -343,7 +344,7 @@ const updatePwdAPI = (req, res, next) => { |
|
|
|
|
|
const validateMobileInSession = (req, res, next) => {
|
|
|
req.body.mobile = req.session.mobile || '';
|
|
|
req.body.verifyCode = req.session.verifyCode || '';
|
|
|
req.body.verifyCode = req.session.captcha || '';
|
|
|
req.body.area = req.session.area || '';
|
|
|
|
|
|
if (!(req.body.mobile && req.body.verifyCode)) {
|
...
|
...
|
@@ -371,7 +372,7 @@ module.exports = { |
|
|
resetPwdSuccessPage, // 重设密码成功页面
|
|
|
|
|
|
validateInputAPI, // 验证用户输入的邮箱或者手机是否合法,返回是json
|
|
|
validateUserPage, // 验证用户输入的邮箱或者手机是否合法,跳转是页面
|
|
|
validateInputPage, // 验证用户输入的邮箱或者手机是否合法,跳转是页面
|
|
|
|
|
|
validateEmailInSession, // 验证邮箱是否在session中
|
|
|
validateMobileInSession, // 验证手机是否在session中
|
...
|
...
|
|