Authored by 郝肖肖

手机验证码登录 检测用户和发短信接口合并

... ... @@ -26,7 +26,7 @@ router.get('/logout.html', login.local.logout);
// 本地登录
// 短信验证码
router.post('/passport/login/sms/send', captcha.requiredAPI, login.local.sms.send); // 发短信验证码
router.post('/passport/login/sms/send', captcha.requiredAPI, login.local.sms.checkUser, login.local.sms.send); // 发短信验证码
router.post('/passport/login/sms/auth', login.local.sms.auth); // 验证短信验证码
router.post('/passport/login/sms/checkuser', login.local.sms.checkUser); // 短信检查用户是否注册
... ...
... ... @@ -150,9 +150,6 @@ var $PhoneLoginSwitcher = $('.switch');
var AccountLoginData = {
PasswordLogin: {
ele: '.password-login',
validateAccountAsync: function() {
return $.Deferred().resolve().promise(); // eslint-disable-line
},
validateAccountLocal: validateAccountPasswordLocal, // eslint-disable-line
creditableToken: getPasswordVal,
type: function() {
... ... @@ -167,30 +164,6 @@ var AccountLoginData = {
},
SMSLogin: {
ele: '.sms-login',
validateAccountAsync: function() {
return $.ajax({
url: '/passport/login/sms/checkuser',
type: 'POST',
data: {
mobile: getAccountVal2(),
area: getAreaCodeVal()
}
}).then(function(result) {
var defer = $.Deferred(); // eslint-disable-line
if (result.code === 200) {
hideAccountTip2(); // eslint-disable-line
defer.resolve();
} else {
showAccountTip2(result.message); // eslint-disable-line
defer.reject();
}
return defer.promise();
});
},
validateAccountLocal: validateAccountSmsLocal, // eslint-disable-line
creditableToken: getCaptchaSmsTokenVal,
type: function() {
... ... @@ -500,7 +473,6 @@ function validateAccountSmsLocal() {
// 本地验证和网络验证
function validateAccount() {
return currentLogin.validateAccountLocal()
.then(currentLogin.validateAccountAsync)
.then(currentLogin.hideAccountTip);
}
... ... @@ -1033,6 +1005,8 @@ $captchaSmsBtn.on('click', function() {
return;
}
hideAccountTip2();
validateAccount()
.then(validateSmsCaptchaImg)
.then(function() {
... ... @@ -1046,6 +1020,10 @@ $captchaSmsBtn.on('click', function() {
smsCaptchaImg.showTip(res.message);
}
if (res.code === 402) {
showAccountTip2(res.message);
}
return $.Deferred().reject().promise(); // eslint-disable-line
}).then(disable60sSendSmsBtn);
});
... ...