Skip to content

Commit 17d3345

Browse files
committed
Project content optimization.
1 parent 52cf73f commit 17d3345

File tree

15 files changed

+283
-12
lines changed

15 files changed

+283
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
out
33
target
44
!.gitignore
5+
*.iml

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
<properties>
1414
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
<maven.compiler.source>1.6</maven.compiler.source>
16+
<maven.compiler.target>1.6</maven.compiler.target>
1517
</properties>
1618

1719
<dependencies>

src/main/java/Utility/BasicTool.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package Utility;
2+
3+
import java.io.UnsupportedEncodingException;
4+
import java.math.BigInteger;
5+
import java.security.MessageDigest;
6+
import java.security.NoSuchAlgorithmException;
7+
8+
public class BasicTool {
9+
10+
public static String getMd5Info(String input) {
11+
try {
12+
MessageDigest md = MessageDigest.getInstance("MD5");
13+
14+
byte[] btArr = input.getBytes("UTF-8");
15+
16+
byte[] result = md.digest(btArr);
17+
18+
BigInteger bigInt = new BigInteger(1, result);
19+
20+
String hastText = bigInt.toString(16);
21+
while (hastText.length() < 32) {
22+
hastText = "0" + hastText;
23+
}
24+
25+
return hastText;
26+
27+
} catch (NoSuchAlgorithmException e) {
28+
e.printStackTrace();
29+
} catch (UnsupportedEncodingException e) {
30+
e.printStackTrace();
31+
}
32+
33+
return "";
34+
35+
}
36+
}

src/main/java/controller/DomesticTicketController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public String testHttpServlet(HttpServletRequest request, HttpServletResponse re
3838
String name = request.getParameter("name");
3939
String id = request.getParameter("id");
4040

41-
System.out.println(name);
42-
System.out.println(id);
4341
model.addAttribute("message", "Test http servlet success!");
4442

4543
logger.info("Test http servlet success!");

src/main/java/controller/LoginController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public String login(@RequestParam("name") String name, String password, ModelMap
5555

5656
return "redirect:/homePage";
5757
} else {
58-
return "login";
58+
return "redirect:/index.jsp";
5959
}
6060
}
6161

@@ -96,4 +96,9 @@ public String logout( SessionStatus status){
9696
return "logout";
9797
}
9898

99+
@RequestMapping(value = "/toRegisterPage")
100+
public String toRegisterPage(){
101+
return "account/accountEdit";
102+
}
103+
99104
}

src/main/java/controller/MyAccountController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class MyAccountController {
2626

2727
@RequestMapping("/edit")
2828
public String editAccount() {
29-
return "account/edit";
29+
return "account/accountEdit";
3030
}
3131

3232
@RequestMapping(value = "/save", method = RequestMethod.POST)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package controller;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
6+
@Controller
7+
@RequestMapping(value = "/wallet")
8+
public class SmallWalletController {
9+
10+
@RequestMapping(value = "/list")
11+
public String list() {
12+
return "smallWallet/walletList";
13+
}
14+
15+
@RequestMapping(value = "/edit")
16+
public String edit() {
17+
return "smallWallet/walletEdit";
18+
}
19+
20+
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package controller;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.RequestMapping;
5+
6+
@Controller
7+
@RequestMapping(value = "/worldBig")
8+
public class WorldBigController {
9+
10+
@RequestMapping(value = "/list")
11+
public String toWorldIndex() {
12+
13+
return "worldBig/worldList";
14+
}
15+
16+
@RequestMapping(value = "/edit")
17+
public String edit() {
18+
return "worldBig/worldEdit";
19+
}
20+
21+
}

src/main/java/service/LoginServiceImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package service;
22

3+
import Utility.BasicTool;
34
import Utility.RedisCache;
45
import com.alibaba.fastjson.JSON;
56
import dao.UserDao;
@@ -53,7 +54,9 @@ public UserInfo queryUser(UserInfo info) {
5354
public boolean checkUserAccess(String userName, String pwd){
5455
UserInfo user=(UserInfo) userDao.findUser(userName);
5556

56-
if (user ==null ||!user.getPassword().equals(pwd)){
57+
String expectedMd5= BasicTool.getMd5Info(pwd);
58+
59+
if (user ==null ||!user.getPassword().equals(expectedMd5)){
5760
return false;
5861
}else{
5962
return true;

0 commit comments

Comments
 (0)