Authored by htoooth

fix

... ... @@ -194,9 +194,11 @@ const bind = {
* code:506 // 手机号码注册过,而且该手机号码也已经绑定过该类型第三方
*/
bind._bindCheck(req, mobile, openId, area, sourceType).then(result => {
if (result.code === 201) {
if (result.code === 201 || result.code === 200) {
req.ctx(BindService).sendBindMsg(area, mobile, id, captcha).then(d => {
if (d && d.code) {
if (d && d.code === 5011) {
return res.json(d);
} else if (d && d.code === 200) {
return res.json(result);
} else {
return res.json({code: 400, message: '', data: ''});
... ...
... ... @@ -114,8 +114,8 @@ module.exports = class extends global.yoho.BaseModel {
/**
* 发送找回手机号短信
*/
async sendCodeToMobileAsync(areaCode, mobile) {
let result = await this.api.sendCodeToMobileAsync(mobile, areaCode);
async sendCodeToMobileAsync(areaCode, mobile, id, captcha) {
let result = await this.api.sendCodeToMobileAsync(mobile, areaCode, id, captcha);
let captchaNeeded = await this.captchaService.try();
... ...
... ... @@ -10,7 +10,7 @@
</p>
<form action="infoform" method="post">
<div class="validaterow">
<div class="yohobindrow" style="height: 120px;">
<div class="yohobindrow" style="height: auto !important;">
<div id="captcha" class="{{#unless @root.captcha.value}}hide{{/unless}}" style="display: inline-block; position: relative;">
</div>
</div>
... ...
... ... @@ -13,9 +13,8 @@ var $sc = $('#send-captcha'),
$next = $('#next-step'),
seconds,
itime,
captcha = new Captcha('#captcha-img').init();
captcha = new Captcha('#captcha-img');
captcha.hide();
captcha.onSuccess(function() {
$sc.trigger('click');
});
... ... @@ -73,7 +72,7 @@ itime = setInterval(function() {
if (seconds === 0) {
clearInterval(itime);
$sc.val('发送验证码').removeClass('disable').removeAttr('disabled');
captcha.show();
captcha.init();
} else {
$sc.val(seconds-- + '秒后可重新操作');
}
... ...
... ... @@ -6,7 +6,7 @@
var $ = require('yoho-jquery');
var Captcha = require('../../plugins/captcha');
var captcha = new Captcha('#captcha').init();
var captcha = new Captcha('#captcha');
var dovalidate = false; // 校验验证码的标识
var isvalidatecode = false; // 是否验证成功的标识
var isvalidatepwd = false; // 密码验证是否通过的标识
... ... @@ -98,6 +98,7 @@ function changeSecond() {
if (second < 0) {
second = 60;
$('.validatewrapper').html(sendmessagehtml);
captcha.init();
return;
} else {
$('.second').text(second);
... ... @@ -115,6 +116,10 @@ function circleTime() {
window.setTimeout(changeSecond, 1000);
}
captcha.onSuccess(function() {
$('#sendmessage').trigger('click');
});
function sendMessageValidate() {
var mobile = '';
var area = '';
... ... @@ -136,10 +141,6 @@ function sendMessageValidate() {
return true;
}
if (data.data && data.data.needCaptcha) {
captcha.show();
}
if (data.code === captcha.errorCode) {
captcha.showTip(data.message);
return;
... ... @@ -319,6 +320,7 @@ function init() {
codeValidate();
validatePwd();
actionConfirm();
circleTime();
}
init();
... ...
... ... @@ -19,17 +19,12 @@ var $wrapper = $('.bindwrapper'),
$nextBtn = $wrapper.find('.yohobindbtn');
var captcha = new Captcha('#captcha').init();
var captcha2 = new Captcha('#captcha2').init().hide();
var captcha2 = new Captcha('#captcha2');
var Alert = require('../../common/dialog').Alert;
require('../../simple-header');
function showCaptchaImg() {
captcha.show();
captcha2.show();
}
/**
* 选择协议
* @return {[type]} [description]
... ... @@ -214,8 +209,7 @@ function changeSecond() {
if (second < 0) {
second = 60;
$('.validatewrapper').html(sendmessagehtml);
captcha2.show();
captcha2.refresh();
captcha2.init();
return;
} else {
$('.second').text(second);
... ... @@ -253,10 +247,6 @@ function sendMessageValidate() {
verifyCode: captcha2.getResults()
}
}).then(function(data) {
if (data.data && data.data.needCaptcha) {
showCaptchaImg();
}
if (data.code === captcha2.errorCode) {
captcha2.showTip(data.message);
return;
... ... @@ -365,8 +355,9 @@ function nextStep() {
success: function(data) {
var winHeight = $(window).height();
if (data.data && data.data.needCaptcha) {
showCaptchaImg();
if (data.code === captcha.errorCode) {
captcha.showTip(data.message);
return;
}
if (data.code === 200) {
... ...
... ... @@ -16,11 +16,16 @@ nopermissionoption = $('#nopermissionmessage').html();
sendmessagehtml = $('.validatewrapper').html();
second = +$('.second').text();
captcha.onSuccess(function() {
$('#sendmessage').trigger('click');
});
function changeSecond() {
second -= 1;
if (second < 0) {
second = 60;
$('.validatewrapper').html(sendmessagehtml);
captcha.refresh();
return;
} else {
$('.second').text(second);
... ...
... ... @@ -22,6 +22,7 @@ var GeeCaptcha = function(container, options) {
this.successCb = null;
this.refreshCb = null;
this.errorCode = CODE_TYPE.errorCode;
this._isInit = false;
// NODE: 这个是专门给自动化测试做的后门
this.$_____trojanYohobuy = this.$container.find('#yohobuy');
... ... @@ -33,6 +34,13 @@ GeeCaptcha.prototype = {
init: function() {
var _this = this;
if (this._isInit) {
this.refresh();
return this;
}
this._isInit = true;
$.get(_this.initURI + '?t=' + $.now()).then(function(result) {
if (result.code === 501) {
window.location.reload(true);
... ...
... ... @@ -20,6 +20,7 @@ var Captcha = function(container, options) {
this.refreshCb = null;
this.running = false;
this.errorCode = CODE_TYPE.errorCode;
this._isInit = false;
// NODE: 这个是专门给自动化测试做的后门
this.$_____trojanYohobuy = null;
... ... @@ -29,8 +30,15 @@ var Captcha = function(container, options) {
Captcha.prototype = {
init: function() {
if (this._isInit) {
this.refresh();
return this;
}
this._isInit = true;
this.bindEvents();
this.refresh();
return this;
},
... ...
... ... @@ -204,7 +204,6 @@
}
.captcha-tool {
height: 110px;
margin-bottom: 0;
}
}
... ...
... ... @@ -5,7 +5,6 @@
margin-top: 25px;
margin-bottom: 25px;
width: 270px;
position: relative;
}
.img-check-header {
... ... @@ -72,7 +71,6 @@
display: inline-block;
position: absolute;
left: 0;
top: 30px;
font-size: 13px;
line-height: 19px;
height: 19px;
... ...