Procházet zdrojové kódy

add:登录页面防止xss

weieryang %!s(int64=3) %!d(string=před) roky
rodič
revize
f986c62165

File diff suppressed because it is too large
+ 2 - 0
WebUI/CallCenterWeb.UI/js/purify.min.js


+ 175 - 152
WebUI/CallCenterWeb.UI/login.html

@@ -1,62 +1,70 @@
1 1
 <!DOCTYPE html>
2 2
 <html lang="en">
3 3
 
4
-	<head>
5
-		<meta charset="utf-8">
6
-		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
7
-		<title>登录</title>
8
-		<meta name="keywords">
9
-		<meta name="description">
10
-		<meta name="renderer" content="webkit">
11
-		<link rel="shortcut icon" href="img/32.ico" />
12
-		<link rel="stylesheet" href="./css/init.css" />
13
-		<script src="./Script/Common/huayi.load.js"></script>
14
-		<script src="./Script/Common/huayi.config.js"></script>
15
-		<script src="./js/jquery.md5.js"></script>
16
-		<script src="./js/aes/crypto-js.js"></script>
17
-		<style>
18
-			html {
19
-				margin: 0 auto;
20
-				padding: 0;
21
-				height: 100%;
22
-				
23
-			}
24
-			body {
25
-				height: 100%;
26
-				background: #fff;
27
-			}
28
-			.wrap {
29
-				width: 100%;
30
-				height: 100%;
31
-			}
32
-			.wrap_right {
33
-				float: left;
34
-				width: 50%;
35
-				height: 100%;
36
-			}
37
-			.wrap_left{
38
-				float: left;
39
-				width: 50%;
40
-				height: 100%;
41
-			}
42
-			.wrap_right{
43
-				position: relative;
44
-			}
45
-			.wrap_bj {
46
-				width: 100%;
47
-				height: 100%;
48
-				background: url(img/left_amg_01.jpg) no-repeat;
49
-				background-size: 100% 100%;
50
-			}
51
-			.tab_box {
52
-				border: 1px solid #41caf2;
53
-				border-top-right-radius: 15px;
54
-				border-bottom-left-radius: 15px;
55
-				margin: 50px auto 65px;
56
-				padding: 0;
57
-				overflow: hidden;
58
-				width: 410px;
59
-			}
4
+<head>
5
+	<meta charset="utf-8">
6
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
7
+	<title>登录</title>
8
+	<meta name="keywords">
9
+	<meta name="description">
10
+	<meta name="renderer" content="webkit">
11
+	<link rel="shortcut icon" href="img/32.ico" />
12
+	<link rel="stylesheet" href="./css/init.css" />
13
+	<script src="./Script/Common/huayi.load.js"></script>
14
+	<script src="./Script/Common/huayi.config.js"></script>
15
+	<script src="./js/jquery.md5.js"></script>
16
+	<script src="./js/purify.min.js"></script>
17
+	<script src="./js/aes/crypto-js.js"></script>
18
+	<style>
19
+		html {
20
+			margin: 0 auto;
21
+			padding: 0;
22
+			height: 100%;
23
+		}
24
+
25
+		body {
26
+			height: 100%;
27
+			background: #fff;
28
+		}
29
+
30
+		.wrap {
31
+			width: 100%;
32
+			height: 100%;
33
+		}
34
+
35
+		.wrap_right {
36
+			float: left;
37
+			width: 50%;
38
+			height: 100%;
39
+		}
40
+
41
+		.wrap_left {
42
+			float: left;
43
+			width: 50%;
44
+			height: 100%;
45
+		}
46
+
47
+		.wrap_right {
48
+			position: relative;
49
+		}
50
+
51
+		.wrap_bj {
52
+			width: 100%;
53
+			height: 100%;
54
+			background: url(img/left_amg_01.jpg) no-repeat;
55
+			background-size: 100% 100%;
56
+		}
57
+
58
+		.tab_box {
59
+			border: 1px solid #41caf2;
60
+			border-top-right-radius: 15px;
61
+			border-bottom-left-radius: 15px;
62
+			margin: 50px auto 65px;
63
+			padding: 0;
64
+			overflow: hidden;
65
+			width: 410px;
66
+		}
67
+
60 68
 			.tab_box ul {
61 69
 				list-style: none;
62 70
 				margin: 0;
@@ -69,17 +77,21 @@
69 77
 				border-bottom: 1px solid #41caf2;
70 78
 				text-align: center;
71 79
 			}
72
-			.tab_box ul li {
73
-				width: 50%;
74
-				float: left;
75
-			}
76
-			.active {
77
-				background: #41caf2;
78
-				color: #fff;
79
-			}
80
-			.tab_content {
81
-				margin: 57px 0 35px 0;
82
-			}
80
+
81
+				.tab_box ul li {
82
+					width: 50%;
83
+					float: left;
84
+				}
85
+
86
+		.active {
87
+			background: #41caf2;
88
+			color: #fff;
89
+		}
90
+
91
+		.tab_content {
92
+			margin: 57px 0 35px 0;
93
+		}
94
+
83 95
 			.tab_content div p {
84 96
 				width: 80%;
85 97
 				margin: 0 auto;
@@ -90,89 +102,100 @@
90 102
 				line-height: 30px;
91 103
 				padding-left: 20px;
92 104
 			}
93
-			.tab_content div p input {
94
-				width: 75%;
95
-				border: 0;
96
-				font-size: 16px;
97
-				outline: none;
98
-				font-family: "仿宋", "宋体";
99
-			}
100
-			.login_icon {
101
-				display: inline-block;
102
-				width: 17px;
103
-				height: 19px;
104
-				vertical-align: middle;
105
-				margin-right: 15px;
106
-			}
107
-			.login_icon_user {
108
-				background: url(img/login_user.png) no-repeat;
109
-			}
110
-			.login_icon_lock {
111
-				background: url(img/login_lock.png) no-repeat;
112
-			}
113
-			.login_icon_hua {
114
-				background: url(img/login_hua.png) no-repeat;
115
-			}
116
-			.login_go {
117
-				text-align: center;
118
-				padding: 0!important;
119
-				font-size: 16px;
120
-				letter-spacing: 16px;
121
-				font-family: "仿宋", "宋体";
122
-				color: #fff;
123
-				filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#1f90ec, endcolorstr=#1cb5ef, gradientType=1);
124
-				background: -webkit-gradient(li near, 0 0, 100% 0, from(#1f90ec), to(#1cb5ef));
125
-				background: -webkit-linear-gradient(left, #1f90ec, #1cb5ef);
126
-				background: -moz-linear-gradient(left, #1f90ec, #1cb5ef);
127
-				background: -o-linear-gradient(left, #1f90ec, #1cb5ef);
128
-				background: linear-gradient(left, #1f90ec, #1cb5ef);
129
-				cursor: pointer;
130
-			}
131
-			
132
-			.error {
133
-				height: 13px;
134
-				background: url(img/yz.png) no-repeat 0 -8px;
135
-				display: none;
136
-			}
137
-			.errorShow {
138
-				display: inline-block;
139
-			}
140
-			.rightCon{
141
-				width: 100%;
142
-				position: absolute;
143
-				top: 0;
144
-				bottom: 0;
145
-				right: 0;
146
-				left: 0;
147
-				margin: auto;
148
-				height: 580px;
149
-			}
150
-			.leftCon{
151
-				width: 30%;
152
-				position: absolute;
153
-				top: 41%;
154
-				bottom: 0;
155
-				right: 0;
156
-				left: 50%;
157
-				margin: auto;
158
-			}
159
-			.leftCon img{
105
+
106
+				.tab_content div p input {
107
+					width: 75%;
108
+					border: 0;
109
+					font-size: 16px;
110
+					outline: none;
111
+					font-family: "仿宋", "宋体";
112
+				}
113
+
114
+		.login_icon {
115
+			display: inline-block;
116
+			width: 17px;
117
+			height: 19px;
118
+			vertical-align: middle;
119
+			margin-right: 15px;
120
+		}
121
+
122
+		.login_icon_user {
123
+			background: url(img/login_user.png) no-repeat;
124
+		}
125
+
126
+		.login_icon_lock {
127
+			background: url(img/login_lock.png) no-repeat;
128
+		}
129
+
130
+		.login_icon_hua {
131
+			background: url(img/login_hua.png) no-repeat;
132
+		}
133
+
134
+		.login_go {
135
+			text-align: center;
136
+			padding: 0 !important;
137
+			font-size: 16px;
138
+			letter-spacing: 16px;
139
+			font-family: "仿宋", "宋体";
140
+			color: #fff;
141
+			filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#1f90ec, endcolorstr=#1cb5ef, gradientType=1);
142
+			background: -webkit-gradient(li near, 0 0, 100% 0, from(#1f90ec), to(#1cb5ef));
143
+			background: -webkit-linear-gradient(left, #1f90ec, #1cb5ef);
144
+			background: -moz-linear-gradient(left, #1f90ec, #1cb5ef);
145
+			background: -o-linear-gradient(left, #1f90ec, #1cb5ef);
146
+			background: linear-gradient(left, #1f90ec, #1cb5ef);
147
+			cursor: pointer;
148
+		}
149
+
150
+		.error {
151
+			height: 13px;
152
+			background: url(img/yz.png) no-repeat 0 -8px;
153
+			display: none;
154
+		}
155
+
156
+		.errorShow {
157
+			display: inline-block;
158
+		}
159
+
160
+		.rightCon {
161
+			width: 100%;
162
+			position: absolute;
163
+			top: 0;
164
+			bottom: 0;
165
+			right: 0;
166
+			left: 0;
167
+			margin: auto;
168
+			height: 580px;
169
+		}
170
+
171
+		.leftCon {
172
+			width: 30%;
173
+			position: absolute;
174
+			top: 41%;
175
+			bottom: 0;
176
+			right: 0;
177
+			left: 50%;
178
+			margin: auto;
179
+		}
180
+
181
+			.leftCon img {
160 182
 				width: 100%;
161 183
 			}
162
-			.leftCon p{
184
+
185
+			.leftCon p {
163 186
 				font-size: 28px;
164
-				letter-spacing:10px;
165
-				color:#e60111;
187
+				letter-spacing: 10px;
188
+				color: #e60111;
166 189
 				line-height: 80px;
167 190
 			}
168
-			.service{
169
-				width: 100%;
170
-				position: absolute;
171
-				bottom: 30px;
172
-				
173
-			}
174
-		</style>
175
-	</head>
191
+
192
+		.service {
193
+			width: 100%;
194
+			position: absolute;
195
+			bottom: 30px;
196
+		}
197
+	</style>
198
+</head>
176 199
 	<body class="signin">
177 200
 		<div class="wrap clearfix">
178 201
 			<div class="wrap_left" style="position: relative;">
@@ -264,12 +287,12 @@
264 287
 				
265 288
 				//坐席登录
266 289
 				$('.login_zx').click(function(){
267
-					var zx_user = $(".zx_user").val();
268
-					var zx_fj = $(".zx_fj").val();
269
-					var zx_psw = $(".zx_psw").val();
290
+                    var zx_user = DOMPurify.sanitize($(".zx_user").val());
291
+                    var zx_fj = DOMPurify.sanitize($(".zx_fj").val());
292
+                    var zx_psw = DOMPurify.sanitize($(".zx_psw").val());
270 293
 					if(zx_user == ""  || zx_fj == "" || zx_psw == "") {
271 294
 						$(".error_zx").addClass('errorShow');
272
-						if($(".zx_user").val() == "") {
295
+                        if (zx_user== "") {
273 296
 							$(".zx_user").focus(function() {
274 297
 								$(".error_zx").removeClass('errorShow');
275 298
 							});
@@ -354,11 +377,11 @@
354 377
 				
355 378
 				//用户登录
356 379
 				$('.login_gl').click(function() {
357
-					var gl_user = $(".gl_user").val();
358
-					var gl_psw = $(".gl_psw").val();
380
+					var gl_user = DOMPurify.sanitize($(".gl_user").val());
381
+                    var gl_psw = DOMPurify.sanitize($(".gl_psw").val());
359 382
 					if(gl_user == "" || gl_psw == "") {
360 383
 						$(".error_gl").addClass('errorShow');
361
-						if($(".gl_user").val() == "") {
384
+                        if (gl_user == "") {
362 385
 							$(".gl_user").focus(function() {
363 386
 								$(".error_gl").removeClass('errorShow');
364 387
 							});