if (username.length === 0 || password.length === 0) {
alert("用户名或密码不允许为空!")
return;
}
userLogin(username, password, captcha);
}
});
function doLogin() {
var username = $("#usernameTxt").val();
var password = $("#passwordTxt").val();
var captcha = $("#captchaTxt").val();
if (username.length === 0 || password.length === 0) {
alert("用户名或密码不允许为空!")
return;
//用户名登录
function userLogin(username, password, captcha) {
var publicKey = "-----BEGIN PUBLIC KEY-----\MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcd+0zTY9Gn94iqkQJTlxYnEnCeFsLkk0a7hoAvi2B74VzDVV3xH0ZO9RkXvo1SgCB+uzbEWdrgQkzTqyjfTtgOguu3OnkVxIMJF34ibchTY0LWHGxq1m2gLGuVVqrlu1LtdV0X7xo/5zc8Mr+46veWb86kSpqe6rOAm69WWo5GwIDAQAB\-----END PUBLIC KEY-----";
var encrypt = new JSEncrypt();
encrypt.setPublicKey(publicKey);
if (userLoginCheck(username, password, captcha)) {
$.ajax({
type: "POST",
dataType: "json",
url: "/QingLong/loginPerson/doLogin",
data: {
"username": username,
"password": encrypt.encrypt(password),
"captcha": captcha
},
async: false,
success: function (result) {
if (result.success) {
window.location.href = '/QingLong/index.html';
} else {
alert(result.msg);
if (result.redirect) {
window.location.href = '/QingLong/plogin.html';
}
refreshCaptcha();
}
}
});
}
}
userLogin(username, password, captcha);
}
//用户名登录
function userLogin(username, password, captcha) {
var publicKey = "-----BEGIN PUBLIC KEY-----\MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCcd+0zTY9Gn94iqkQJTlxYnEnCeFsLkk0a7hoAvi2B74VzDVV3xH0ZO9RkXvo1SgCB+uzbEWdrgQkzTqyjfTtgOguu3OnkVxIMJF34ibchTY0LWHGxq1m2gLGuVVqrlu1LtdV0X7xo/5zc8Mr+46veWb86kSpqe6rOAm69WWo5GwIDAQAB\-----END PUBLIC KEY-----";
var encrypt = new JSEncrypt();
encrypt.setPublicKey(publicKey);
//用户登录检查
function userLoginCheck(username, password, captcha) {
if (username == null || username == "") {
alert("用户名不允许为空!");
return false;
}
if (password == null || password == "") {
alert("密码不允许为空!");
return false;
}
if (captcha == null || captcha == "") {
alert("验证码不允许为空!");
return false;
}
return true;
}
//开启错误提示
function showError(error) {
$(".form-error").find("label").html(error);
$(".form-error").show();
}
if (userLoginCheck(username, password, captcha)) {
//获取页面信息
function getPageInfo() {
$.ajax({
type: "POST",
dataType: "json",
url: "/QingLong/loginPerson/doLogin",
url: "/baseService/global/getGlobalValueByKey",
data: {
"username": username,
"password": encrypt.encrypt(password),
"captcha": captcha
"key": "title,copy_right"
},
async: false,
success: function (result) {
if (result.success) {
window.location.href = '/QingLong/index.html';
} else {
alert(result.msg);
if(result.redirect){
window.location.href = '/QingLong/plogin.html';
}
refreshCaptcha();
if (result.success) {
$("#system_name").html(result.title);
$("#copyright").html(result.copy_right);
$('title').html(result.title);
}
}
});
}
}
//用户登录检查
function userLoginCheck(username, password, captcha) {