Authored by yyq

fix privacy protection

... ... @@ -14,6 +14,14 @@ const crypto = global.yoho.crypto;
const AccountApi = require('./account-api');
const CaptchaImgService = require('../../passport/models/captcha-img-service');
const _privacyProtection = (str, start = 0, end = 0) => {
if (!str || !(end - start > 0)) {
return '';
}
return `${str.slice(0, 3)}****${str.slice(7)}`;
}
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
... ... @@ -104,11 +112,12 @@ module.exports = class extends global.yoho.BaseModel {
name: 'password'
}
];
let formData2 = [
{// 只验证手机号
inputTxt: '已验证的手机号',
isVerify: true,
verifyAccount: data.mobile.slice(0, 3) + '****' + data.mobile.slice(7),
verifyAccount: _privacyProtection(data.mobile, 3, 7),
realAccount: data.mobile
}
];
... ... @@ -117,7 +126,7 @@ module.exports = class extends global.yoho.BaseModel {
{// 只验证邮箱
inputTxt: '已验证邮箱',
isVerify: true,
verifyAccount: data.email.slice(0, 2) + '****' + data.email.slice(6),
verifyAccount: _privacyProtection(data.email, 2, 6),
realAccount: data.email
}
];
... ... @@ -351,7 +360,7 @@ module.exports = class extends global.yoho.BaseModel {
resq[1].icon = verifyData.mobileVerify === 'N' ? 'warning' : 'ok';
resq[1].isValid = verifyData.mobileVerify === 'N' ? false : true;
resq[1].tip = verifyData.mobileVerify === 'N' ? '验证后,可用于找回登录密码。' :
'您验证的手机:' + verifyData.mobile.slice(0, 3) + '****' + verifyData.mobile.slice(7);
'您验证的手机:' + _privacyProtection(verifyData.mobile, 3, 7);
}
return resq;
... ... @@ -661,7 +670,7 @@ module.exports = class extends global.yoho.BaseModel {
],
returnInfo: true,
sendEmail: {
emailInfo: email.slice(0, 2) + '****' + email.slice(6),
emailInfo: _privacyProtection(email, 2, 6),
emailUrl: emailDomain
}
};
... ...