...
|
...
|
@@ -68,11 +68,11 @@ var $accountInput1 = $('#account1'), |
|
|
},
|
|
|
$captchaSmsBtn = $('.change-captcha-sms'),
|
|
|
$captchaSmsTokenHideInput = $('#captcha-sms-token-hide'),
|
|
|
newCaptchaImg = new BrandIcoCaptcha('.sms-captcha-img-wrap').init(),
|
|
|
getCaptchaSmsTokenVal = function() { // 短信登录凭证
|
|
|
return $.trim($captchaSmsTokenHideInput.val());
|
|
|
},
|
|
|
$smsCaptchaImgWrapper = $('.sms-captcha-img-wrap'),
|
|
|
newCaptchaImg = new BrandIcoCaptcha('.sms-captcha-img-wrap').init(),
|
|
|
$smsCaptchaImgInput = $smsCaptchaImgWrapper.find('#sms-captcha-input'),
|
|
|
getSmsCaptchaImgVal = function() { // 短信登录图形验证码
|
|
|
return newCaptchaImg.getResults();
|
...
|
...
|
@@ -109,7 +109,6 @@ var $accountTip1 = $accountInput1.siblings('.err-tip'), |
|
|
$passwordTip = $passwordInput.siblings('.err-tip'),
|
|
|
$captchaImgTip = $captchaImgInput.siblings('.err-tip'),
|
|
|
$captchaSmsTip = $captchaSmsInput.siblings('.err-tip'),
|
|
|
$smsCaptchaImgTip = $smsCaptchaImgInput.siblings('.err-tip'),
|
|
|
$capsLock = $('#caps-lock');
|
|
|
|
|
|
var mailPhoneRegx = require('../common/mail-phone-regx'), // 邮箱格式验证
|
...
|
...
|
@@ -276,7 +275,6 @@ accountChangeEvent.add(function(type) { |
|
|
$captchaImgInput.val('');
|
|
|
|
|
|
$captchaSmsInput.val('');
|
|
|
$smsCaptchaImgInput.val('');
|
|
|
$captchaSmsTokenHideInput.val('');
|
|
|
|
|
|
if (type === AccountLoginData.QRCodeLogin.name) {
|
...
|
...
|
@@ -318,7 +316,6 @@ mobileTipShowOnce.add(function() { |
|
|
|
|
|
refreshSmsImgCallBack.add(function() {
|
|
|
refreshSmsCaptchaImg();
|
|
|
$smsCaptchaImgInput.val('');
|
|
|
});
|
|
|
|
|
|
/** ************************************************************************/
|
...
|
...
|
@@ -396,13 +393,13 @@ function hideCaptchaSmsTip() { |
|
|
|
|
|
/** ************************************************************************/
|
|
|
|
|
|
function showSmsCaptchaImgTip(msg) {
|
|
|
function showSmsCaptchaImgTip() {
|
|
|
refreshSmsImgCallBack.fire();
|
|
|
return errTipShow($smsCaptchaImgTip, $smsCaptchaImgInput, msg);
|
|
|
newCaptchaImg.showTip();
|
|
|
}
|
|
|
|
|
|
function hideSmsCaptchaImgTip() {
|
|
|
return errTipHide($smsCaptchaImgTip, $smsCaptchaImgInput);
|
|
|
newCaptchaImg.hideTip();
|
|
|
}
|
|
|
|
|
|
/** ************************************************************************/
|
...
|
...
|
@@ -709,64 +706,8 @@ function sendCaptchaSmsAsync() { |
|
|
/* 短信验证图形验证 */
|
|
|
/** ************************************************************************/
|
|
|
|
|
|
function smsCaptchaImgLocal() {
|
|
|
var captcha = getSmsCaptchaImgVal(),
|
|
|
err;
|
|
|
|
|
|
var defer = $.Deferred(); // eslint-disable-line
|
|
|
|
|
|
if (captcha !== '') {
|
|
|
if (captcha.length !== 4) {
|
|
|
err = '请输入长度为4字符的验证码';
|
|
|
|
|
|
defer.reject();
|
|
|
} else {
|
|
|
|
|
|
defer.resolve();
|
|
|
}
|
|
|
} else {
|
|
|
err = '请输入验证码';
|
|
|
|
|
|
defer.reject();
|
|
|
}
|
|
|
|
|
|
if (defer.state() === 'resolved') {
|
|
|
hideSmsCaptchaImgTip();
|
|
|
} else {
|
|
|
showSmsCaptchaImgTip(err);
|
|
|
}
|
|
|
|
|
|
return defer.promise();
|
|
|
}
|
|
|
|
|
|
function smsCaptchaImgAsync() {
|
|
|
return $.ajax({
|
|
|
url: '/passport/captcha/img',
|
|
|
type: 'POST',
|
|
|
data: {
|
|
|
verifyCode: getSmsCaptchaImgVal()
|
|
|
}
|
|
|
}).then(function(result) {
|
|
|
var defer = $.Deferred(); // eslint-disable-line
|
|
|
|
|
|
if (result.code === 200) {
|
|
|
hideSmsCaptchaImgTip();
|
|
|
|
|
|
defer.resolve();
|
|
|
} else {
|
|
|
showSmsCaptchaImgTip('验证码不正确');
|
|
|
|
|
|
defer.reject();
|
|
|
}
|
|
|
|
|
|
return defer.promise();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function validateSmsCaptchaImg() {
|
|
|
return smsCaptchaImgLocal()
|
|
|
.then(smsCaptchaImgAsync)
|
|
|
.then(hideSmsCaptchaImgTip);
|
|
|
return newCaptchaImg.check();
|
|
|
}
|
|
|
|
|
|
function refreshSmsCaptchaImg() {
|
...
|
...
|
@@ -1141,11 +1082,6 @@ $captchaImgWrapper.on('click', '.change-captcha, .captcha-img', function() { |
|
|
$captchaImgPic.attr('src', CAPTCHA_IMG_URL + $.now());
|
|
|
});
|
|
|
|
|
|
// 刷新短信图形验证码
|
|
|
$smsCaptchaImgWrapper.on('click', '.change-captcha, .captcha-img', function() {
|
|
|
refreshSmsCaptchaImg();
|
|
|
});
|
|
|
|
|
|
// 切换登录模式:密码登录和短信登录
|
|
|
$PhoneLoginSwitcher.on('click', 'div', function() {
|
|
|
var $this = $(this),
|
...
|
...
|
|