Commit 6c867d27d4c79f29f7b054ee1e3acd23715dde2c

Authored by 王通
2 parents cc96fe44 6a0c82bc

Merge branch 'minhang_autho' of

http://192.168.168.201:8888/panzhaov5/bsth_control.git into
minhang_autho

Conflicts:
	src/main/resources/static/index.html
src/main/java/com/bsth/controller/sys/UserController.java
... ... @@ -51,11 +51,12 @@ public class UserController extends BaseController<SysUser, Integer> {
51 51 public static Map<String, Integer> captchaMap = new HashMap<>();
52 52  
53 53 @RequestMapping(value = "/login", method = RequestMethod.POST)
54   - public Map<String, Object> login(HttpServletRequest request, @RequestParam String userName,
55   - @RequestParam String password, String captcha) {
  54 + public Map<String, Object> login(HttpServletRequest request, @RequestParam String data, String captcha) {
56 55  
57 56 Map<String, Object> rs = new HashMap<>();
58 57 rs.put("status", ResponseCode.ERROR);
  58 + String userName="";
  59 + String password="";
59 60 try {
60 61 HttpSession session = request.getSession();
61 62 rs.put("captcha", session.getAttribute("captcha"));
... ... @@ -74,8 +75,9 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
74 75  
75 76 //解密RSA
76 77 try {
77   - userName = RSAUtils.decryptBase64(userName);
78   - password = RSAUtils.decryptBase64(password);
  78 + String userpwd=RSAUtils.decryptBase64(data);
  79 + userName=userpwd.split("1q2a3d")[0];
  80 + password=userpwd.split("1q2a3d")[1];
79 81 } catch (RuntimeException e) {
80 82 return put(rs, "msg", "decrypt RSA fail!可能页面已过期,尝试刷新页面。");
81 83 }
... ...
src/main/java/com/bsth/filter/XssHttpServletRequestWrapper.java
... ... @@ -33,9 +33,25 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
33 33 String[] escapseValues = new String[length];
34 34 for (int i = 0; i < length; i++) {
35 35 escapseValues[i] = StringEscapeUtils.escapeHtml4(values[i]);
  36 + escapseValues[i] = sqlIntercept(escapseValues[i]);
36 37 }
37 38 return escapseValues;
38 39 }
39 40 return super.getParameterValues(name);
40 41 }
  42 +
  43 + public String sqlIntercept(String param){
  44 + String rs = param;
  45 +
  46 + String inj_str = "'|and|exec|execute|insert|select|delete|update|count|drop|*|%|chr|mid|master|truncate|char|declare|into|sitename|net user|xp_cmdshell|;|or|+|,|create|table|from|grant|use|group_concat|column_name|alert|expression|{|}|[|]|information_schema.columns|table_schema|union|where|order|by|--|like|//|/|#|<|>|(|)|script";
  47 + String[] characterParams = inj_str.split("\\|");
  48 + for(String str:characterParams){
  49 + if(param.contains(str)){
  50 + rs = " ";
  51 + return rs;
  52 + }
  53 + }
  54 +
  55 + return rs;
  56 + }
41 57 }
... ...
src/main/resources/static/index.html
... ... @@ -630,8 +630,14 @@
630 630 <script
631 631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"
632 632 data-exclude=1></script>
  633 +<<<<<<< HEAD
633 634 <!-- echarts4 误删 -->
634 635 <script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script>
635 636  
  637 +=======
  638 +
  639 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
  640 +<script src="/metronic_v4.5.4/plugins/jquery-validation/js/additional-methods.js"></script>
  641 +>>>>>>> branch 'minhang_autho' of http://192.168.168.201:8888/panzhaov5/bsth_control.git
636 642 </body>
637 643 </html>
638 644 \ No newline at end of file
... ...
src/main/resources/static/login.html
... ... @@ -293,25 +293,25 @@
293 293 $('#loginBtn').on('click', function(){
294 294 if(lock || $(this).attr('disabled')) return;
295 295 var userName = nameInput.val()
296   - ,pwd = pwdInput.val();
  296 + ,pwd = pwdInput.val(),data=userName+'1q2a3d'+pwd;
297 297  
298 298 //RSA加密
299 299 var encrypt = new JSEncrypt();
300 300 encrypt.setPublicKey(keys);
301 301 userName = encrypt.encrypt(userName);
302 302 pwd = encrypt.encrypt(pwd);
  303 + data=encrypt.encrypt(data);
303 304 //登录
304   - login(userName, pwd);
  305 + login(userName, data);
305 306 });
306 307  
307 308 var lock;
308   - function login(userName, pwd){
  309 + function login(userName, data){
309 310 lock = true;
310 311 $('#loginBtn').attr('disabled', 'disabled');
311 312  
312 313 var params = {
313   - userName: userName,
314   - password: pwd,
  314 + data: data,
315 315 captcha: $('input[name=captcha]').val()
316 316 };
317 317 $.post('/user/login', params
... ...
src/main/resources/static/metronic_v4.5.4/plugins/jquery-validation/js/additional-methods.js
... ... @@ -36,7 +36,13 @@
36 36 regex = /\b\w+\b/g;
37 37 return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
38 38 }, $.validator.format("Please enter between {0} and {1} words."));
39   -
  39 + $.validator.addMethod("passwordRule", function(value, element, param) {
  40 + var length = value.length;
  41 + var letter=/^.*[a-zA-Z]+.*$/;
  42 + var num=/^.*[0-9]+.*$/;
  43 + var symbol=/^.*([^a-zA-Z0-9])+.*$/;
  44 + return length>10&& letter.test(value)&& num.test(value)&&symbol.test(value);
  45 + }, $.validator.format("请确保输入的值包含字母、数字、特殊符号"));
40 46 }());
41 47  
42 48 // Accept a value from a file input based on a required mimetype
... ...
src/main/resources/static/metronic_v4.5.4/plugins/jquery-validation/js/localization/messages_zh.js
... ... @@ -20,6 +20,7 @@ $.extend($.validator.messages, {
20 20 number: "请输入有效的数字",
21 21 digits: "只能输入数字",
22 22 creditcard: "请输入有效的信用卡号码",
  23 + passwordRule: "请确保输入的值包含字母、数字、特殊符号",
23 24 equalTo: "你的输入不相同",
24 25 extension: "请输入有效的后缀",
25 26 maxlength: $.validator.format("最多可以输入 {0} 个字符"),
... ...
src/main/resources/static/pages/permission/user/add.html
... ... @@ -119,8 +119,9 @@
119 119 },
120 120 'password' : {
121 121 required : true,
122   - minlength: 6,
123   - maxlength: 25
  122 + minlength: 10,
  123 + maxlength: 25,
  124 + passwordRule:true
124 125 },
125 126 'cfmPassword' : {
126 127 equalTo: '#password'
... ...