Authored by 陈峰

Merge branch 'feature/safe-bug' into gray

... ... @@ -162,8 +162,10 @@ function validateImgCaptcha() {
}()).then(function() {
hideTip($imgCaptchaInput);
ep.emit('captcha-img', true);
return true;
}).fail(function() {
ep.emit('captcha-img', false);
return false;
});
}
... ... @@ -196,14 +198,11 @@ function validateSMSCaptchaAsync() {
return false;
}
switch (data.code) {
case 200:
return true;
case 400:
errTip($smsCaptchaInput, '短信验证码错误');
return false;
default:
return false;
if (data.code === 200) {
return true;
} else {
errTip($smsCaptchaInput, data.message);
return false;
}
});
}
... ... @@ -479,7 +478,7 @@ exports.init = function() {
// 验证图形输入
$imgCaptchaInput.on('blur', function() {
validateImgCaptcha();
// validateImgCaptcha();
$imgCaptchaInput.removeClass('focus');
}).on('focus', function() {
hideTip($imgCaptchaInput);
... ... @@ -570,19 +569,28 @@ exports.init = function() {
// 点击发送验证码
$smsCaptchaCtrl.on('click', function() {
if ($smsCaptchaCtrl.hasClass('disable') || $smsCaptchaCtrl.hasClass('second-progress')) {
return;
}
$smsCaptchaCtrl.addClass('disable');
disableSMSBtn();
sendSMSCaptcha().then((data)=>{
if (data.code !== 200) {
errTip($imgCaptchaInput, data.message);
refreshImgCaptcha();
} else {
hideTip($smsCaptchaInput);
// if ($smsCaptchaCtrl.hasClass('disable') || $smsCaptchaCtrl.hasClass('second-progress')) {
// return;
// }
validateImgCaptcha().then(allow=>{
if (allow) {
$smsCaptchaCtrl.addClass('disable');
disableSMSBtn();
sendSMSCaptcha().then((data)=>{
if (data.code !== 200) {
if (data.code === 404) {
errTip($phoneNumInput, data.message);
} else {
errTip($imgCaptchaInput, data.message);
}
refreshImgCaptcha();
} else {
hideTip($smsCaptchaInput);
}
});
}
});
});
... ...