Authored by htoooth

fix

... ... @@ -215,7 +215,8 @@ const renren = {
const cancelBind = (req, res) => {
let type = req.params.type;
if (!(req.get('Refer') || '').match(/yohobuy.com/)) {
if (!(req.get('Referer') || '').match(/yohobuy.com/)) {
return res.send({
code: 501,
message: '非法请求'
... ...
... ... @@ -44,6 +44,10 @@ const bind = {
title: '联合登录补全信息'
});
},
captchaSuccess: (req, res) => {
req.session.type = 'relateStep1';
return res.json({code: 200, message: '验证成功'});
},
noregist: (req, res) => {
let mobile = req.body.mobile;
let sourceType = req.body.sourceType;
... ... @@ -69,6 +73,10 @@ const bind = {
let openId = req.body.openId;
let area = req.body.area;
if (req.session.verifyCode !== 'relateStep1') {
return next();
}
// UserService.findByMobileAsync(area, mobile).then(user => {
// if (user) {
// return {
... ... @@ -113,6 +121,8 @@ const bind = {
title: '绑定手机号'
};
req.session.type = '';
res.render('bind/success', data);
},
bindCheck: (req, res, next) => {
... ... @@ -121,6 +131,10 @@ const bind = {
let area = req.body.area || '86';
let sourceType = req.body.sourceType;
if (req.session.type !== 'relateStep1') {
return res.json({code: 400, message: '非法请求'});
}
if (mobile && openId && area && sourceType) {
/**
... ... @@ -170,6 +184,10 @@ const bind = {
let mobile = req.body.mobile;
let area = req.body.area;
if (req.session.type !== 'relateStep1') {
return res.json({code: 400, message: '非法请求'});
}
bindService.sendBindMsg(area, mobile).then(result => {
if (result && result.code) {
return res.json(result);
... ...
... ... @@ -65,9 +65,10 @@ router.get('/passport/login/renren/callback', login.renren.callback);
router.get('/passport/login/account', login.common.needCaptcha);
// 第三方登录后绑定
router.get('/passport/thirdlogin/index', bind.indexPage);
router.get('/passport/thirdlogin/index', captcha.tryGeetest, bind.indexPage);
router.get('/passport/thirdlogin/bindsuccess', bind.bindSuccess);
router.post('/passport/thirdlogin/noregist', bind.noregist);
router.post('/passport/thirdlogin/checkCaptcha', captcha.requiredAPI, bind.captchaSuccess); // 图形验证码成功
router.post('/passport/thirdlogin/relate', bind.relate);
router.post('/passport/autouserinfo/bindCheck', bind.bindCheck);
... ...
... ... @@ -4,7 +4,7 @@
<span class="yoho">YOHO!FAMILY</span>
</h3>
<p class="safeword">为了您的账户安全,请您完善账户信息,以便为您提供更优质的服务</p>
<p class="safeword">**为了您的账户安全,请您完善账户信息,以便为您提供更优质的服务</p>
<form action="" id="bindmobileform" method="post">
<input type="hidden" value="{{openId}}" id="openId" name="openId"/>
<input type="hidden" value="{{sourceType}}" id="sourceType" name="sourceType"/>
... ... @@ -41,6 +41,12 @@
</div>
</div>
</div>
<div class="yohobindrow" style="height: 100px;">
<div class="name phonetag"></div>
<div id="captcha" style="display: inline-block; position: relative;">
</div>
</div>
</form>
<div class="protoctolwrapper">
... ... @@ -120,4 +126,6 @@
</div>
</div>
<div class="backdrop" style="display:none"></div>
</div>
\ No newline at end of file
</div>
{{> gee-captcha}}
... ...
... ... @@ -5,6 +5,7 @@
*/
var $ = require('yoho-jquery');
var phoneRegx = require('../common/mail-phone-regx').phoneRegx;
var Captcha = require('../../plugins/captcha');
var nopermissionoption = $('#nopermissionmessage').html(); // 倒计时dom
var sendmessagehtml = $('.validatewrapper').html(); // 发送短信dom
... ... @@ -17,6 +18,8 @@ var $wrapper = $('.bindwrapper'),
$phoneTip = $wrapper.find('.phone-err-tip'),
$nextBtn = $wrapper.find('.yohobindbtn');
var captcha = new Captcha('#captcha', {checkURI: '/passport/thirdlogin/checkCaptcha'}).init();
require('../../simple-header');
/**
... ... @@ -229,6 +232,7 @@ function sendMessageValidate() {
return;
}
circleTime($('#mobile').val());
$.ajax({
type: 'POST',
url: '/passport/autouserinfo/sendBindMsg',
... ... @@ -323,76 +327,77 @@ function nextStep() {
}
openId = $('#openId').val() || '29803EC6D4AAC3AAB8ABDB6AE829D579';
sourceType = $('#sourceType').val() || 'qq';
$.ajax({
type: 'post',
url: '/passport/autouserinfo/bindCheck',
data: {
mobile: mobile,
area: areaCode,
openId: openId,
sourceType: sourceType
},
dataType: 'json',
success: function(data) {
var winHeight = $(window).height();
if (data.code === 200) {
$('#bindmobileform').attr('action', data.data.next);
$('#bindmobileform').submit();
} else if (data.code === 201) {
// 已注册 未绑定
username = data.data.user.username;
headImg = data.data.user.headImg;
$('#registphone').text(mobile);
$('#username').text(username);
if (headImg === '') {
$('#userphoto').attr('src', 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/' +
'01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100');
} else {
$('#userphoto').attr('src', headImg);
}
$('#logindirectly2').attr('href', data.data.user.bindLogin);
$('.backdrop').show();
$('#sendmessage').click();
$('#alreayregist .mask').css({
'padding-top': winHeight > 440 ? winHeight / 2 : 217
});
$('#alreayregist').show();
} else if (data.code === 203) {
// 已注册 可关联
$('#bindmobileform').attr('action', data.data.next);
$('#bindmobileform').submit();
} else if (data.code === 205) {
// 未注册 不可关联
username = data.data.user.username;
headImg = data.data.user.headImg;
$('#registphonetwo').text(mobile);
$('#username1').text(username);
if (headImg === '') {
$('#userphoto1').attr('src', 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/' +
'01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100');
captcha.check().then(function() {
$.ajax({
type: 'post',
url: '/passport/autouserinfo/bindCheck',
data: {
mobile: mobile,
area: areaCode,
openId: openId,
sourceType: sourceType
},
dataType: 'json',
success: function(data) {
var winHeight = $(window).height();
if (data.code === 200) {
$('#bindmobileform').attr('action', data.data.next);
$('#bindmobileform').submit();
} else if (data.code === 201) {
// 已注册 未绑定
username = data.data.user.username;
headImg = data.data.user.headImg;
$('#registphone').text(mobile);
$('#username').text(username);
if (headImg === '') {
$('#userphoto').attr('src', 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/' +
'01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100');
} else {
$('#userphoto').attr('src', headImg);
}
$('#logindirectly2').attr('href', data.data.user.bindLogin);
$('.backdrop').show();
$('#sendmessage').click();
$('#alreayregist .mask').css({
'padding-top': winHeight > 440 ? winHeight / 2 : 217
});
$('#alreayregist').show();
} else if (data.code === 203) {
// 已注册 可关联
$('#bindmobileform').attr('action', data.data.next);
$('#bindmobileform').submit();
} else if (data.code === 205) {
// 未注册 不可关联
username = data.data.user.username;
headImg = data.data.user.headImg;
$('#registphonetwo').text(mobile);
$('#username1').text(username);
if (headImg === '') {
$('#userphoto1').attr('src', 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/' +
'01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100');
} else {
$('#userphoto1').attr('src', headImg);
}
$('#logindirectly').attr('href', data.data.user.bindLogin);
$('.backdrop').show();
$('#bindconfirm .mask').css({
'padding-top': winHeight > 440 ? winHeight / 2 : 217
});
$('#bindconfirm').show();
} else if (data.code === 402) {
$phoneTip.find('em').text('手机格式错误');
$phoneTip.removeClass('hide');
} else {
$('#userphoto1').attr('src', headImg);
if (data && data.message) {
alert(data.message); // eslint-disable-line
}
}
$('#logindirectly').attr('href', data.data.user.bindLogin);
$('.backdrop').show();
$('#bindconfirm .mask').css({
'padding-top': winHeight > 440 ? winHeight / 2 : 217
});
$('#bindconfirm').show();
} else if (data.code === 402) {
$phoneTip.find('em').text('手机格式错误');
$phoneTip.removeClass('hide');
} else {
if (data && data.message) {
alert(data.message); // eslint-disable-line
}
}
}
});
});
});
}
... ...
... ... @@ -37,8 +37,12 @@
.bindwrapper {
margin: 0 auto;
padding-top: 122px;
min-height: 450px;
min-height: 550px;
width: 980px;
.img-check-tip {
top: 110px !important;
}
}
.welcomeword {
... ...