...
|
...
|
@@ -12,6 +12,7 @@ const accountModel = require('../models/account'); |
|
|
const passportHelper = require('../../passport/models/passport-helper');
|
|
|
const Promise = require('bluebird');
|
|
|
const co = Promise.coroutine;
|
|
|
const regMobile = /(\d{3})\d{4}(\d{4})/;//正则匹配替换手机号码中间4位
|
|
|
|
|
|
|
|
|
const captchaUrl = helpers.urlFormat('/passport/images', {t: Date.now()});
|
...
|
...
|
@@ -79,8 +80,7 @@ const index = (req, res, next) => { |
|
|
result.info.gender ? result.genders[result.info.gender - 1].checked = true :
|
|
|
result.genders[2].checked = true;
|
|
|
result.info.head_ico = result.info.head_ico ? helpers.image(result.info.head_ico, 400, 300, 2) : '';
|
|
|
result.info.mobile = result.info.mobile ?
|
|
|
result.info.mobile.substring(0, 3) + '****' + result.info.mobile.substring(7, 11) : '';
|
|
|
result.info.mobile = result.info.mobile ? result.info.mobile.replace(regMobile, "$1****$2") : '';
|
|
|
result.stepUrl = '/me/setting/step1';
|
|
|
res.display('index', {
|
|
|
module: 'me',
|
...
|
...
|
@@ -102,19 +102,20 @@ const index = (req, res, next) => { |
|
|
* 编辑信息
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @param next
|
|
|
*/
|
|
|
const editUserInfo = (req, res)=> {
|
|
|
const editUserInfo = (req, res, next)=> {
|
|
|
let uid = req.user.uid;
|
|
|
let query = req.body;
|
|
|
|
|
|
settingModel.editUserInfo(uid, query).then(result=> {
|
|
|
res.send(result);
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
|
|
|
/*
|
|
|
* step1
|
|
|
* step1 绑定的手机号码身份验证
|
|
|
* */
|
|
|
const bindMobile = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
...
|
...
|
@@ -124,7 +125,7 @@ const bindMobile = (req, res, next) => { |
|
|
if (result.info.verify_mobile !== '') {
|
|
|
let info = result.info;
|
|
|
|
|
|
info.ellipsisMobile = info.verify_mobile.substring(0, 3) + '****' + info.verify_mobile.substring(7, 11);
|
|
|
info.ellipsisMobile = info.verify_mobile.replace(regMobile, "$1****$2");
|
|
|
info.checkCode = settingModel.cipheriv(info.uid + '.completeverify');
|
|
|
|
|
|
res.display('index', {
|
...
|
...
|
@@ -150,6 +151,9 @@ const bindMobile = (req, res, next) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* step1 绑定的邮箱进行身份验证
|
|
|
*/
|
|
|
const bindEmail = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let type = req.params.type;
|
...
|
...
|
@@ -181,6 +185,9 @@ const bindEmail = (req, res, next) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
*step1 登录密码进行身份验证
|
|
|
*/
|
|
|
const modifyPassword = (req, res) => {
|
|
|
let type = req.params.type;
|
|
|
let checkCode = settingModel.cipheriv(req.user.uid + '.completeverify');
|
...
|
...
|
@@ -204,7 +211,7 @@ const modifyPassword = (req, res) => { |
|
|
};
|
|
|
|
|
|
/*
|
|
|
* step2 渲染页面
|
|
|
* step2 操作界面-渲染页面
|
|
|
* */
|
|
|
const edit = (req, res)=> {
|
|
|
let type = req.params.type;
|
...
|
...
|
@@ -243,7 +250,7 @@ const edit = (req, res)=> { |
|
|
};
|
|
|
|
|
|
/*
|
|
|
* step3
|
|
|
* step3 操作成功-渲染界面
|
|
|
* */
|
|
|
const success = (req, res)=> {
|
|
|
let type = req.params.type;
|
...
|
...
|
@@ -280,7 +287,7 @@ const success = (req, res)=> { |
|
|
};
|
|
|
|
|
|
/*
|
|
|
* post1
|
|
|
* post1 第一步的post请求
|
|
|
* */
|
|
|
const validate1 = (req, res)=> {
|
|
|
co(function *() {
|
...
|
...
|
@@ -305,7 +312,7 @@ const validate1 = (req, res)=> { |
|
|
};
|
|
|
|
|
|
/*
|
|
|
* post2
|
|
|
* post2 第二步的post请求
|
|
|
* */
|
|
|
const validate2 = (req, res)=> {
|
|
|
co(function *() {
|
...
|
...
|
|