File: /web/data/www.tbbprovision.com/static/js/user.js
var userobj={
login:function(){
$('input[name=account]').focus();
$('#defaultForm').bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
// invalid: 'glyphicon glyphicon-remove',
// validating: 'glyphicon glyphicon-refresh'
},
fields: {
email: {
message: '邮箱格式错误',
validators: {
notEmpty: {message: '邮箱不能为空'},
regexp: {
regexp: /[a-z0-9][a-z\.0-9-_]+@[a-z0-9_-]+(?:\.[a-z]{1,3}\.[a-z]{1,3}|\.[a-z]{1,3})/i,
message: '邮箱格式错误'
}
}
},
password: {
message: 'The username is not valid',
validators: {
notEmpty: {message: '密码不能为空'}
}
},
code: {
message: 'The username is not valid',
validators: {
notEmpty: {message: '验证码不能为空'}
}
}
}
}).on('success.form.bv', function(e) {
e.preventDefault();
var $form = $(e.target);
var bv = $form.data('bootstrapValidator');
$.ajax({
type:"POST",
url:$('#defaultForm').attr('action'),
// url:'http://www.google.com',
data:$('#defaultForm').serialize(),
dataType:"json",
timeout : 10000,
beforeSend: function(){$("#validateBtn").button('loading');},
error: function(xhrData){
global.toastr('warning',xhrData.responseText);
},
success: function(xhrData){
global.toastr('success',xhrData.response_content);
/*setTimeout(function () {
window.location.reload();
},1000);*/
},
complete: function(xhrData){
$("#validateBtn").button('reset');
}
});
});
}
}