Authored by xuqi

login auth.Review by:@xuqi

... ... @@ -3,7 +3,6 @@
{{# passport}}
{{> passport/cover}}
<div class="content">
<form id="login-form" method="POST" action="/passport/login/login">
<ul class="login-ul">
<li class="relative clearfix">
<h2 class="title">会员登录</h2>
... ... @@ -26,7 +25,7 @@
</span>
</li>
<li class="relative">
<input id="password" class="password input va" name="password" type="text" placeholder="密码" autocomplete="off" maxlength="20">
<input id="password" class="password input va" name="password" type="password" placeholder="密码" autocomplete="off" maxlength="20">
<span id="caps-lock" class="caps-lock hide">大写状态开启</span>
<span class="err-tip hide">
<i></i>
... ... @@ -69,7 +68,6 @@
</li>
</ul>
<input id="country-code-hide" name="countryCode" type="hidden" value="{{countryCode}}">
</form>
</div>
{{/ passport}}
</div>
... ...
... ... @@ -31,6 +31,8 @@ var checkbox = {
unchecked: '&#xe613;'
};
var authing = false;
var emailAcTime;
require('yoho.placeholder');
... ... @@ -46,7 +48,7 @@ function validateAccount() {
if (/^[0-9]+$/.test(account)) {
//如果是纯数字,则作为手机号码处理
if (mailPhoneRegx.phoneRegx['+' + $countryCodeHide.val()].test(account)) {
if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) {
pass = true;
} else {
pass = false;
... ... @@ -97,6 +99,7 @@ function validatePassword() {
$passwordTip.removeClass('hide').children('em').text(err);
$password.addClass('error');
}
return pass;
}
//验证
... ... @@ -254,7 +257,29 @@ $('.va').on('focus', function() {
$('#login-btn').on('click', function() {
var pass = validate();
if (pass) {
$('#login-form').submit();
if (pass && authing === false) {
authing = true;
$.ajax({
url: '/passport/login/auth',
type: 'POST',
data: {
areaCode: $countryCodeHide.val().replace('+', ''),
account: $.trim($account.val()),
password: $.trim($password.val())
},
success: function(data) {
if (data.code === 400) {
$passwordTip.removeClass('hide').children('em').text(data.message);
$password.addClass('error');
return;
} else {
location.href = data.data.href;
}
},
complete: function() {
authing = false;
}
});
}
});
\ No newline at end of file
... ...