Authored by wenjiekong

添加账号安全js

/**
* 个人中心---账户安全
* @author gaohongwei <hongwei.gao@yoho.cn>
* @date: 2016/8/30
*/
'use strict';
const mRoot = '../models';
const accountService = require(`${mRoot}/account-service`); // user model
/**
* 账户安全
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res, next) => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
let uid = '8039836';
let responseData = {
module: 'home',
page: 'account'
};
// 真实数据输出
accountService.getAccountInfo(channel, uid).then(result => {
responseData.user = result;
responseData.headerData = result.headerData;
responseData.meAccountPage = true;
responseData.account = {
allAccounts: result
};
res.render('home/account/account', responseData);
}).catch(next);
};
... ...
/**
* 个人中心---账户安全
* @author gaohongwei <hongwei.gao@yoho.cn>
* @date: 2016/8/30
*/
'use strict';
const api = global.yoho.API;
const getVerifyInfo = uid => {
return api.get('', {
method: 'web.passport.getUserVerifyInfo',
uid: uid
});
};
module.exports = {
getVerifyInfo
};
... ...
/**
* 个人中心---账户安全
* @author gaohongwei <hongwei.gao@yoho.cn>
* @date: 2016/8/30
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const helpers = global.yoho.helpers;
const accountApi = require('./account-api');
const headerModel = require('../../../doraemon/models/header');
const getAccountInfo = (channel, uid) => {
return co(function*() {
let resq = [{
icon: 'ok',
type: '登录密码',
tip: '互联网帐号存在被盗风险,建议您定期更改密码以保护帐号安全。',
red: 'true',
url: helpers.urlFormat('/home/account/userpwd'),
isValid: true
}, {
icon: 'warning',
type: '邮箱验证',
tip: '验证后,可用于找回登录密码。',
url: helpers.urlFormat('/home/account/email')
}, {
icon: 'warning',
type: '手机验证',
tip: '验证后,可用于找回登录密码。',
url: helpers.urlFormat('/home/account/mobile')
}];
let verifyResult = yield accountApi.getVerifyInfo(uid);
resq.headerData = yield headerModel.requestHeaderData(channel);
if (verifyResult.data) {
let verifyData = verifyResult.data;
resq[1].icon = verifyData.emailVerify === 'N' ? 'warning' : 'ok';
resq[1].tip = verifyData.emailVerify === 'N' ? '验证后,可用于找回登录密码。' :
'您验证的邮箱:' + verifyData.email.slice(0, 2) + '****' + verifyData.email.slice(6);
resq[1].isValid = verifyData.emailVerify === 'N' ? false : true;
resq[2].icon = verifyData.mobileVerify === 'N' ? 'warning' : 'ok';
resq[2].isValid = verifyData.mobileVerify === 'N' ? false : true;
resq[2].tip = verifyData.mobileVerify === 'N' ? '验证后,可用于找回登录密码。' :
'您验证的手机:' + verifyData.mobile.slice(0, 3) + '****' + verifyData.email.slice(7);
}
return resq;
})();
};
module.exports = {
getAccountInfo
};
... ...
... ... @@ -25,6 +25,7 @@ const VipController = require(`${cRoot}/vip`);
const FavoriteController = require(`${cRoot}/Favorite`);
const CouponsController = require(`${cRoot}/coupons`);
const UserController = require(`${cRoot}/user`);
const AccountController = require(`${cRoot}/account`);
const homeNav = [
{
... ... @@ -163,6 +164,8 @@ router.post('/user/isbrandname', UserController.isBrandName);
router.get('/address/area', UserController.getProviceList);
router.get('/account', [getCommonHeader, getHomeNav], AccountController.index);
router.get('/favorite', FavoriteController.index);
router.get('/coupons', CouponsController.index);
... ...
{{> layout/header}}
<div class="user-me-page me-page yoho-page clearfix">
{{# account}}
{{> path}}
{{> navigation}}
<div class="me-main">
<div class="account block">
<div class="title">
<h2>
账号安全
<span>SECURITY</span>
</h2>
</div>
<div class="edit-box">
{{#each allAccounts}}
<div class="account-row">
<div class="content">
<div class="left-content">
<span class="icon-{{icon}}"></span>
<span class="account-type">{{type}}</span>
</div>
<div class="middle-content">
<span class="tip {{#red}}red{{/red}}">{{tip}}</span>
</div>
<div class="right-content">
{{#if isValid}}
<span class="center"><a href="{{url}}">修改</a></span>
{{else}}
<span class="center">
<a href="{{url}}" class="button-icon20 button-sliver20 openboxa">
<span>
<i>立即验证</i>
</span>
</a>
</span>
{{/if}}
</div>
{{> path}}
{{> navigation}}
{{# account}}
<div class="me-main">
<div class="account block">
<div class="title">
<h2>
账号安全
<span>SECURITY</span>
</h2>
</div>
<div class="edit-box">
{{#each allAccounts}}
<div class="account-row">
<div class="content">
<div class="left-content">
<span class="icon-{{icon}}"></span>
<span class="account-type">{{type}}</span>
</div>
<div class="middle-content">
<span class="tip {{#red}}red{{/red}}">{{tip}}</span>
</div>
<div class="right-content">
{{#if isValid}}
<span class="center"><a href="{{url}}">修改</a></span>
{{else}}
<span class="center">
<a href="{{url}}" class="button-icon20 button-sliver20 openboxa">
<span>
<i>立即验证</i>
</span>
</a>
</span>
{{/if}}
</div>
</div>
{{/each}}
<div class="main-info">
<p class="p1">
安全提示服务
</p>
<p>
1. 确认您登录的是YOHO!BUY 有货网址
<span class="blue2">http://www.yohobuy.com</span>
,注意防范进入钓鱼网站,别轻信各种即时通讯发的商品或链接,谨防诈骗。
</p>
<p>2. 建议您安装杀毒软件,并定期更新操作系统等软件补丁,确保帐户及交易安全。</p>
</div>
</div>
{{/each}}
<div class="main-info">
<p class="p1">
安全提示服务
</p>
<p>
1. 确认您登录的是YOHO!BUY 有货网址
<span class="blue2">http://www.yohobuy.com</span>
,注意防范进入钓鱼网站,别轻信各种即时通讯发的商品或链接,谨防诈骗。
</p>
<p>2. 建议您安装杀毒软件,并定期更新操作系统等软件补丁,确保帐户及交易安全。</p>
</div>
</div>
</div>
{{/ account}}
{{> help-us}}
</div>
{{/ account}}
</div>
{{> layout/footer}}
... ...