<!DOCTYPE>
|
<html>
|
<head>
|
<title>Óû§µÇ¼</title>
|
<meta charset="GBK" />
|
<meta http-equiv="pragma" content="no-cache" />
|
<meta http-equiv="cache-control" content="no-cache" />
|
<meta http-equiv="expires" content="0" />
|
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
|
<script src="js/jquery.min.js"></script>
|
<script src="js/rsa.min.js"></script>
|
</head>
|
<body style="height: 100%; width: 100%; padding: 0; margin: 0; overflow: hidden;">
|
<div style="padding: 20px; box-sizing: border-box;">
|
<section>
|
<p style="font-size: 18px; font-weight: bold;">µ¥µãµÇ¼</p>
|
</section>
|
<!-- Óû§Ãû -->
|
<section>
|
<label for="username">Óû§Ãû£º</label>
|
<input class="required" id="username" placeholder="ÇëÊäÈëÓû§Ãû" size="20" tabindex="1"
|
type="text" accesskey="n" autocomplete="off" name="username" value="admin" />
|
</section>
|
<!-- ÃÜÂë -->
|
<section>
|
<div class="loginpwd" style='width: 400px; margin-right: 20px; margin-top: 30px; border-bottom: 1px solid #fff;'>
|
<span style="visibility: hidden;">Çë</span><label for="password">ÃÜÂ룺</label>
|
<input class="required" placeholder="ÇëÊäÈëÃÜÂë" type="password" id="password" size="20" tabindex="2"
|
accesskey="p" autocomplete="off" name="password" value="Admin@1234_lf" /><span id="capslock-on" style="display: none;">
|
<i class="fa fa-exclamation-circle"></i>
|
<span>CAPSLOCK key is turned on!</span>
|
</span>
|
</div>
|
</section>
|
<!-- µÇ¼°´Å¥ -->
|
<section>
|
<span style="visibility: hidden;">ÇëÊäÈ룺</span>
|
<input style="margin-top: 25px; cursor: pointer;" name="submit" accesskey="l" value="µÇ ¼" tabindex="3" type="button" onclick="sysLogin();">
|
</section>
|
</div>
|
<script>
|
var url = "http://127.0.0.1:12316/server/";
|
|
var isBusy = false;
|
|
window.onload = function () {
|
getPublicKey();
|
}
|
|
function getPublicKey() {
|
$.get(url + "sign/getPublicKey", function (rs) {
|
if (rs && rs.code == 200) {
|
window.encrypt = new JSEncrypt();
|
encrypt.setPublicKey(rs.result);
|
}
|
});
|
}
|
|
function sysValidate() {
|
// ÑéÖ¤Óû§ÃûÓëÃÜÂë
|
var theUsername = document.getElementById("username").value;
|
if (theUsername.length <= 0) {
|
$("#eMsg").html("Ìáʾ£ºÇëÊäÈëÓû§Ãû£¡");
|
$("#username").focus();
|
return false;
|
}
|
var thePassword = document.getElementById("password").value;
|
if (thePassword.length <= 0) {
|
$("#eMsg").html("Ìáʾ£ºÇëÊäÈëÃÜÂ룡");
|
$("#password").focus();
|
return false;
|
}
|
|
return true;
|
}
|
|
function sysLogin() {
|
if (isBusy || !sysValidate()) {
|
return;
|
}
|
|
isBusy = true;
|
var username = $.trim($("#username").val());
|
var password = $("#password").val();
|
|
var data = {
|
"uid": encrypt.encrypt(username),
|
"pwd": encrypt.encrypt(password)
|
};
|
|
$.ajax({
|
url: url + "sign/login",
|
type: "POST",
|
data: JSON.stringify(data),
|
dataType: "json", // html¡¢json¡¢jsonp¡¢script¡¢text
|
contentType: "application/json", // "application/json", "application/x-www-form-urlencoded",
|
success: function (rs) {
|
isBusy = false;
|
|
if (!rs || rs.code != 200) {
|
var msg = rs && rs.msg ? rs.msg : "µÇ¼ʧ°Ü£¡";
|
$("#eMsg").html(msg);
|
return;
|
}
|
|
alert("µÇ¼³É¹¦£¡");
|
setLoginInfo(rs.result);
|
},
|
error: function (e) {
|
isBusy = false;
|
console.error(e);
|
alert("µÇ¼³ö´í£¬ÇëÁªÏµ¹ÜÀíÔ±£¡");
|
}
|
});
|
}
|
|
function ajax(url, type, data, dataType, contentType, fn, efn) {
|
$.ajax({
|
url: url,
|
type: type,
|
data: data,
|
dataType: dataType || "json", // html¡¢json¡¢jsonp¡¢script¡¢text
|
contentType: contentType || "application/json", // "application/x-www-form-urlencoded"
|
success: function (data) {
|
fn(data);
|
},
|
error: function (e) {
|
console.error(e);
|
fn();
|
}
|
});
|
}
|
|
document.onkeydown = function (e) {
|
var ev = window.event || e;
|
var code = ev.keyCode || ev.which || ev.charCode;
|
if (code == 13) {
|
sysLogin();
|
}
|
}
|
|
function setLoginInfo(rs) {
|
try {
|
ntst.setLogin(rs.createUser, rs.uname, rs.token);
|
} catch (e) {
|
//
|
}
|
}
|
|
function isValid(pwd) {
|
if (pwd) {
|
var regex = new RegExp('^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\W!@#$%^&*`~()\\-_+=,.?;<>]{12,20}$');
|
return regex.test(pwd)
|
}
|
return false;
|
}
|
</script>
|
</body>
|
</html>
|