Authored by htoooth

login模块移除手机号和邮箱验证

... ... @@ -18,7 +18,7 @@ var countryPhoneRegx = {
'+61': /^[0-9]{11}$/
};
var emailRegx = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
var emailRegx = /@/;
var pwdValidateRegx = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/;
... ...
... ... @@ -49,7 +49,8 @@ var $accountInput = $('#account'),
// 图像验证码
$captchaImgInput = $('#captcha'),
$captchaWrap = $('.captcha-wrap'),
$captchaImgWrapper = $('.captcha-wrap'),
$captchaImgPic = $captchaImgWrapper.find('#captcha-img'),
getCaptchaImgVal = function() {
return $.trim($captchaImgInput.val());
},
... ... @@ -74,7 +75,10 @@ var $accountInput = $('#account'),
$countryList = $('#country-list'),
// 记住我
$rememberMe = $('.remember-me');
$rememberMe = $('.remember-me'),
getRememberMeVal = function() {
return $rememberMe.hasClass('checked') ? true : false;
};
// 提示
var $accountTip = $accountInput.siblings('.err-tip'),
... ... @@ -268,23 +272,14 @@ function hideCaptchaSmsTip() {
// 本地验证用户输入格式
function validateAccountPasswordLocal() {
var account = getAccountVal(),
countryCode = getAreaCodeVal(),
err;
var defer = $.Deferred(); // eslint-disable-line
if (account !== '') {
if (/^[0-9]+$/.test(account)) {
// 如果是纯数字,则作为手机号码处理
if (countryCode !== '+86' ||
mailPhoneRegx.phoneRegx[countryCode].test(account)) {
defer.resolve();
} else {
defer.reject();
err = '手机号码不正确,请重新输入';
}
} else {
if (mailPhoneRegx.emailRegx.test(account)) {
defer.resolve();
} else {
... ... @@ -427,7 +422,7 @@ function validateCaptchaImgAsync() {
// 本地和网络验证图形验证码
function validateCaptchaImg() {
// 验证码不可见的时候验证通过
if ($captchaWrap.is(':hidden')) {
if ($captchaImgWrapper.is(':hidden')) {
return $.Deferred().resolve().promise(); //eslint-disable-line
}
... ... @@ -591,9 +586,9 @@ function preSmsLoginWithValidate() {
// 密码错误次数,超过三次显示验证码
function vaAccountErrTimes() {
$captchaImgInput.attr('src', CAPTCHA_IMG_URL + $.now());
$captchaImgPic.attr('src', CAPTCHA_IMG_URL + $.now());
$captchaImgInput.val('');
$captchaWrap.removeClass('hide');
$captchaImgWrapper.removeClass('hide');
}
// 短信验证码重新发送
... ... @@ -650,7 +645,7 @@ function login() {
account: getAccountVal(),
password: currentLogin.creditableToken(),
captcha: getCaptchaImgVal(),
isRemember: $rememberMe.hasClass('checked') ? true : false,
isRemember: getRememberMeVal(),
loginType: currentLogin.type()
}
});
... ... @@ -792,8 +787,8 @@ $('.va').on('focus', function() {
});
// 验证码刷新
$captchaWrap.on('click', '.change-captcha, .captcha-img', function() {
$captchaImgInput.attr('src', CAPTCHA_IMG_URL + $.now());
$captchaImgWrapper.on('click', '.change-captcha, .captcha-img', function() {
$captchaImgPic.attr('src', CAPTCHA_IMG_URL + $.now());
});
// 切换登录模式:密码登录和短信登录
... ...