Authored by zhaoyue

Merge branch 'zhaoyue-dev3' into 'master'

Zhaoyue dev3



See merge request !33
@@ -2,8 +2,8 @@ git pull @@ -2,8 +2,8 @@ git pull
2 git add --all src/main/java/* 2 git add --all src/main/java/*
3 git add push.sh 3 git add push.sh
4 git add pom.xml 4 git add pom.xml
5 -git commit -m "rm trim" 5 +git commit -m "MOD admin pass"
6 #git push origin master 6 #git push origin master
7 -git push origin zhaoyue-dev2 7 +git push origin zhaoyue-dev3
8 git status 8 git status
9 git pull 9 git pull
@@ -58,8 +58,13 @@ public class AdminAccountController { @@ -58,8 +58,13 @@ public class AdminAccountController {
58 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR),HttpStatus.OK); 58 return new ResponseEntity<>(ResultModel.error(ResultStatus.USERNAME_OR_PASSWORD_ERROR),HttpStatus.OK);
59 } 59 }
60 String salt = admin.getSalt(); 60 String salt = admin.getSalt();
  61 + String adminType = Integer.toString(admin.getType());
  62 + String str = account + password + adminType + salt; // 构建待加密字符串
  63 + String calcuPass = SecurityTool.encode(SecurityTool.ALGORITHM_MD5, str);
  64 +
61 String pass_in_db = admin.getPwd(); 65 String pass_in_db = admin.getPwd();
62 - String calcuPass = SecurityTool.getPassword(account, password, salt); 66 +
  67 +// String calcuPass = SecurityTool.getPassword(account, password, salt);
63 if (!calcuPass.equals(pass_in_db) ||//密码错误 68 if (!calcuPass.equals(pass_in_db) ||//密码错误
64 admin.getStatus() != 1) {//用户无效 69 admin.getStatus() != 1) {//用户无效
65 //提示用户名或密码错误 70 //提示用户名或密码错误
@@ -11,6 +11,7 @@ import java.util.Random; @@ -11,6 +11,7 @@ import java.util.Random;
11 */ 11 */
12 public class SecurityTool { 12 public class SecurityTool {
13 private static final String ALGORITHM = "SHA1"; 13 private static final String ALGORITHM = "SHA1";
  14 + public static final String ALGORITHM_MD5 = "MD5";
14 15
15 private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 16 private static final char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd',
16 'e', 'f' }; 17 'e', 'f' };