Authored by zhangxiaoru

注册

... ... @@ -115,6 +115,7 @@ let verifyMobile = (req, res, next) => {
let mobile = +req.body.phoneNum;
let area = +(req.body.areaCode || 86);
let inviteCode = +req.body.inviteCode || '';
// 判断参数是否合法
if (!_.isNumber(mobile) || !_.isNumber(area)) {
... ... @@ -153,7 +154,8 @@ let verifyMobile = (req, res, next) => {
result.data = helpers.urlFormat('/passport/reg/code', {
token: token,
phoneNum: mobile,
areaCode: area
areaCode: area,
inviteCode: inviteCode
});
}
... ... @@ -169,6 +171,7 @@ let codeAction = (req, res, next) => {
let token = req.query.token;
let mobile = +req.query.phoneNum;
let area = +(req.query.areaCode || 86);
let inviteCode = +req.query.inviteCode || '';
// 判断是否允许访问, 不允许则跳转到错误页面
if (!_.isString(token) || !_.isNumber(mobile) || !sign.verifyToken(mobile, token)) {
... ... @@ -190,6 +193,7 @@ let codeAction = (req, res, next) => {
areaCode: area, // 默认的区号
phoneNum: mobile, // 手机号
token: token, // 访问令牌
inviteCode: inviteCode,
serviceUrl: serviceUrl // 在线客服
});
};
... ... @@ -275,6 +279,7 @@ let verifyCode = (req, res, next) => {
let mobile = +req.body.phoneNum;
let area = +(req.body.areaCode || 86);
let code = +req.body.code;
let inviteCode = +req.body.inviteCode || '';
/* 判断参数是否合法 */
if (!_.isNumber(mobile) || !_.isNumber(area) || !_.isNumber(code)) {
... ... @@ -306,7 +311,8 @@ let verifyCode = (req, res, next) => {
token: token,
phoneNum: mobile,
areaCode: area,
smsCode: code
smsCode: code,
inviteCode: inviteCode
});
break;
case 404:
... ... @@ -326,6 +332,7 @@ let passwordAction = (req, res, next) => {
let mobile = +req.query.phoneNum;
let area = +(req.query.areaCode || 86);
let smsCode = +req.query.smsCode;
let inviteCode = +req.query.inviteCode || '';
// 判断是否允许访问, 不允许则跳转到错误页面
if (!smsCode || !_.isString(token) || !_.isNumber(mobile) ||
... ... @@ -345,7 +352,8 @@ let passwordAction = (req, res, next) => {
areaCode: area, // 默认的区号
phoneNum: mobile, // 手机号
token: token, // 访问令牌
smsCode: smsCode // 手机验证码
smsCode: smsCode, // 手机验证码
inviteCode: inviteCode
});
};
... ... @@ -362,6 +370,7 @@ let setPassword = (req, res, next) => {
let token = req.body.token;
let smsCode = +req.body.smsCode;
let isFromMy = _.get(req.session, 'phoneReg.isFromMy', '0');
let inviteCode = req.body.inviteCode || '';
// 判断参数是否合法
if (!smsCode || !_.isString(token) || !_.isNumber(mobile) || !_.isNumber(area) || !password) {
... ... @@ -386,7 +395,7 @@ let setPassword = (req, res, next) => {
// 验证注册的标识码是否有效
let resultCopy = null;
RegService.regMobileAes(area, mobile, password, shoppingKey, smsCode, isFromMy).then((result) => {
RegService.regMobileAes(area, mobile, password, shoppingKey, smsCode, inviteCode, isFromMy).then((result) => {
if (!result.code || result.code !== 200) {
return res.send(result);
}
... ...
... ... @@ -96,7 +96,7 @@ const RegService = {
return api.post('', params);
},
regMobileAes(area, mobile, password, shoppingKey, smsCode, isFromMy) {
regMobileAes(area, mobile, password, shoppingKey, smsCode, inviteCode, isFromMy) {
isFromMy = isFromMy || '0';
let params = {
... ... @@ -105,6 +105,7 @@ const RegService = {
profile: mobile,
password: aes.aesPwd(password),
verifyCode: smsCode,
inviteCode: inviteCode,
isFromMy
};
... ...
... ... @@ -6,6 +6,10 @@
<span id="area-code" class="area-code">{{areaCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<div class="input-container row code-container">
<span id="code" class="invite-code">邀请码</span>
<input id="invite-code" class="input code" type="text">
</div>
{{!--图片验证--}}
<div data-geetest="{{useGeetest}}" id="js-img-check"></div>
... ... @@ -13,4 +17,4 @@
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="register-tip">Yoho!Family账号可登录Yoho!Buy有货、Yoho!Now、mars及SHOW</p>
</div>
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -17,6 +17,7 @@
<input id="area-code" type="hidden" value="{{areaCode}}">
<input id="token" type="hidden" value="{{token}}">
<input id="sms-code" type="hidden" value="{{smsCode}}">
<input id="invite-code" type="hidden" value="{{inviteCode}}">
</div>
<div class="prompt">
... ... @@ -24,6 +25,6 @@
<div class="choose">
<span class="ensure"></span>
<span class="deny"></span>
</div>
</div>
... ...
... ... @@ -19,4 +19,5 @@
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
<input id="invite-code" type="hidden" value={{inviteCode}}>
</div>
... ...
... ... @@ -15,7 +15,8 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
areaCode = $('#area-code').val().replace('+', ''),
inviteCode = $('#invite-code').val();
let api = require('./api');
let tip = require('plugin/tip');
... ... @@ -64,7 +65,8 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
phoneNum: phoneNum,
areaCode: areaCode,
code: trim($captcha.val()),
token: $('#token').val()
token: $('#token').val(),
inviteCode: inviteCode
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -74,7 +74,8 @@ function setPassword() {
phoneNum: $('#phone-num').val(),
areaCode: $('#area-code').val(),
smsCode: $('#sms-code').val(),
token: $('#token').val()
token: $('#token').val(),
inviteCode: $('#invite-code').val()
},
success: function(data) {
let res = data.data;
... ...
... ... @@ -81,7 +81,8 @@ $btnNext.on('touchstart', function() {
requested = true;
let params = {
areaCode: areaCode.replace('+', ''),
phoneNum: pn
phoneNum: pn,
inviteCode: $('#invite-code').val()
};
$.extend(params, result);
... ...
... ... @@ -150,10 +150,20 @@ body.passport-body {
line-height: 2.5;
}
.invite-code {
position: absolute;
left: 15PX;
line-height: 2.5;
}
.phone-container {
padding-left: 55PX;
}
.code-container {
padding-left: 70PX;
}
.input {
width: 100%;
line-height: 26PX;
... ...