forked from UlordChain/Ulord-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
112 lines (107 loc) · 5.07 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ulord主节点管理后台-登录</title>
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div class="modal fade bd-example-modal-sm" id="myModal" role="dialog" data-backdrop="false" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<p class="text-center mb-0">
<i class="fa fa-check-circle text-success mr-1" aria-hidden="true"></i>
<span class="content">提交成功</span>
</p>
</div>
</div>
</div>
<div class="web-container">
<div class="form-bg login">
<div class="container container2">
<div class="row">
<div class="col-md-offset-3 col-md-6">
<form class="form-horizontal">
<span class="heading">Ulord主节点管理后台</span>
<div class="form-group user">
<input type="text" class="form-control" id="username" placeholder="用户名" value="admin" readonly="readonly">
<i class="fa fa-user"></i>
</div>
<div class="form-group">
<input type="password" class="form-control" id="defaultPwd" minlength="8" maxlength="20" placeholder="密码">
<i class="fa fa-lock"></i>
<!-- <a href="javascript:alert('登陆后,会进入修改密码界面');" class="fa fa-question-circle"></a> -->
</div>
<div class="form-group help">
<!-- <div class="main-checkbox">
<input type="checkbox" value="None" id="checkbox1" name="check"/>
<label for="checkbox1"></label>
</div> -->
<!-- <a class="forget-pwd" href="forget.html">忘记密码?</a> -->
<a id="submit" href="javascript:;" class="btn btn-default">登录</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
$(function(){
function myModal(label,text){
var collection = 'fa-check-circle text-success fa-exclamation-circle text-warning fa-times-circle text-danger'
if(label==1){
$('#myModal .modal-content .fa').removeClass(collection).addClass('fa-check-circle text-success')
}else if(label==0){
$('#myModal .modal-content .fa').removeClass(collection).addClass('fa-exclamation-circle text-warning')
}else if(label==2){
$('#myModal .modal-content .fa').removeClass(collection).addClass('fa-times-circle text-danger')
}
$('#myModal .content').html(text);
$('#myModal').modal('show')
setTimeout(function(){
$('#myModal').modal('hide')
}, 10000)
}
function fPostData(){
var user = $('#username').val();
var pwd = $('#defaultPwd').val();
//alert('本机输入的用户名是:'+user+',密码是:'+pwd);
$.ajax({
type: "GET",
url: '../cgi-bin/login.cgi',
data: 'name='+user+'&pwd='+pwd,
success: function (data){
if (data.status === 1) {
window.localStorage.setItem('sessionid',data.sessionid)
if($('#defaultPwd').val() === 'admin'){
window.location.href = "webConfig.html?type=1";
}else {
window.location.href = 'webConfig.html'
}
} else {
alert('第一次使用默认密码登录或密码错误');
}
},
error: function(error){
alert('返回错误信息:' + error);
}
});
}
$('#submit').on('click', function() {
if($('#defaultPwd').val().match(/^(?=.*[A-Za-z])(?=.*\d)[^]{8,20}$/)){
fPostData();
}else {
myModal(2,'密码必须大于8位,包含数字和字母!')
}
})
})
</script>
</body>
</html>