|
@@ -31,6 +31,8 @@ var checkbox = { |
|
@@ -31,6 +31,8 @@ var checkbox = { |
31
|
unchecked: ''
|
31
|
unchecked: ''
|
32
|
};
|
32
|
};
|
33
|
|
33
|
|
|
|
34
|
+var authing = false;
|
|
|
35
|
+
|
34
|
var emailAcTime;
|
36
|
var emailAcTime;
|
35
|
|
37
|
|
36
|
require('yoho.placeholder');
|
38
|
require('yoho.placeholder');
|
|
@@ -46,7 +48,7 @@ function validateAccount() { |
|
@@ -46,7 +48,7 @@ function validateAccount() { |
46
|
if (/^[0-9]+$/.test(account)) {
|
48
|
if (/^[0-9]+$/.test(account)) {
|
47
|
|
49
|
|
48
|
//如果是纯数字,则作为手机号码处理
|
50
|
//如果是纯数字,则作为手机号码处理
|
49
|
- if (mailPhoneRegx.phoneRegx['+' + $countryCodeHide.val()].test(account)) {
|
51
|
+ if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) {
|
50
|
pass = true;
|
52
|
pass = true;
|
51
|
} else {
|
53
|
} else {
|
52
|
pass = false;
|
54
|
pass = false;
|
|
@@ -97,6 +99,7 @@ function validatePassword() { |
|
@@ -97,6 +99,7 @@ function validatePassword() { |
97
|
$passwordTip.removeClass('hide').children('em').text(err);
|
99
|
$passwordTip.removeClass('hide').children('em').text(err);
|
98
|
$password.addClass('error');
|
100
|
$password.addClass('error');
|
99
|
}
|
101
|
}
|
|
|
102
|
+ return pass;
|
100
|
}
|
103
|
}
|
101
|
|
104
|
|
102
|
//验证
|
105
|
//验证
|
|
@@ -254,7 +257,29 @@ $('.va').on('focus', function() { |
|
@@ -254,7 +257,29 @@ $('.va').on('focus', function() { |
254
|
$('#login-btn').on('click', function() {
|
257
|
$('#login-btn').on('click', function() {
|
255
|
var pass = validate();
|
258
|
var pass = validate();
|
256
|
|
259
|
|
257
|
- if (pass) {
|
|
|
258
|
- $('#login-form').submit();
|
260
|
+ if (pass && authing === false) {
|
|
|
261
|
+ authing = true;
|
|
|
262
|
+
|
|
|
263
|
+ $.ajax({
|
|
|
264
|
+ url: '/passport/login/auth',
|
|
|
265
|
+ type: 'POST',
|
|
|
266
|
+ data: {
|
|
|
267
|
+ areaCode: $countryCodeHide.val().replace('+', ''),
|
|
|
268
|
+ account: $.trim($account.val()),
|
|
|
269
|
+ password: $.trim($password.val())
|
|
|
270
|
+ },
|
|
|
271
|
+ success: function(data) {
|
|
|
272
|
+ if (data.code === 400) {
|
|
|
273
|
+ $passwordTip.removeClass('hide').children('em').text(data.message);
|
|
|
274
|
+ $password.addClass('error');
|
|
|
275
|
+ return;
|
|
|
276
|
+ } else {
|
|
|
277
|
+ location.href = data.data.href;
|
|
|
278
|
+ }
|
|
|
279
|
+ },
|
|
|
280
|
+ complete: function() {
|
|
|
281
|
+ authing = false;
|
|
|
282
|
+ }
|
|
|
283
|
+ });
|
259
|
}
|
284
|
}
|
260
|
}); |
285
|
}); |