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;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<%--
2+
Created by IntelliJ IDEA.
3+
User: pengfei
4+
Date: 2017/9/24
5+
Time: 17:17
6+
To change this template use File | Settings | File Templates.
7+
--%>
8+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9+
<html>
10+
<head>
11+
<title>Edit Account</title>
12+
<meta name="viewport" content="width=device-width, initial-scale=1">
13+
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
14+
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
15+
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
16+
17+
</head>
18+
<body>
19+
20+
<div>
21+
<div class="panel panel-warning" style="height: 100%;margin-bottom: 0px">
22+
<div class="panel-heading">
23+
<h3 class="panel-title" style="margin:auto">Welcome back, user! </h3>
24+
</div>
25+
<div class="panel-body" style="width:40%; margin: auto;margin-top:30px">
26+
<form class="bs-example bs-example-form" role="form" method="post" action="/account/save"
27+
enctype="multipart/form-data">
28+
29+
<div class="input-group">
30+
<span class="input-group-addon">名称</span>
31+
<input type="text" class="form-control" placeholder="Your name" name="name">
32+
</div>
33+
<br>
34+
<div class="input-group">
35+
<span class="input-group-addon">密码</span>
36+
<input type="password" class="form-control" placeholder="Your password" name="password">
37+
</div>
38+
<br>
39+
<div class="input-group">
40+
<span class="input-group-addon">邮件</span>
41+
<input type="text" class="form-control" placeholder="Your email" name="email">
42+
</div>
43+
<br>
44+
45+
<div class="input-group">
46+
<span class="input-group-addon">头像</span>
47+
<input type="file" class="form-control" placeholder="Your photo" name="image">
48+
</div>
49+
50+
<br>
51+
<div class="input-group">
52+
<span class="input-group-addon">保存</span>
53+
<input type="submit" class="form-control" value="Save">
54+
</div>
55+
<br>
56+
57+
</form>
58+
</div>
59+
</div>
60+
61+
</div>
62+
63+
</body>
64+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<%--
2+
Created by IntelliJ IDEA.
3+
User: jack_bai
4+
Date: 23/04/2018
5+
Time: 11:06 PM
6+
To change this template use File | Settings | File Templates.
7+
--%>
8+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9+
<html>
10+
<head>
11+
<title>World Outside</title>
12+
</head>
13+
<body>
14+
15+
</body>
16+
</html>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<%--
2+
Created by IntelliJ IDEA.
3+
User: pengfei
4+
Date: 2017/9/24
5+
Time: 17:17
6+
To change this template use File | Settings | File Templates.
7+
--%>
8+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9+
<html>
10+
<head>
11+
<title>Edit Account</title>
12+
<meta name="viewport" content="width=device-width, initial-scale=1">
13+
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
14+
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
15+
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
16+
17+
</head>
18+
<body>
19+
20+
<div>
21+
<div class="panel panel-danger" style="height: 100%;margin-bottom: 0px">
22+
<div class="panel-heading">
23+
<h3 class="panel-title" style="margin:auto">Welcome back, user! </h3>
24+
</div>
25+
<div class="panel-body" style="width:40%; margin: auto;margin-top:30px">
26+
<form class="bs-example bs-example-form" role="form" method="post" action="/account/save"
27+
enctype="multipart/form-data">
28+
29+
<div class="input-group">
30+
<span class="input-group-addon">名称</span>
31+
<input type="text" class="form-control" placeholder="Your name" name="name">
32+
</div>
33+
<br>
34+
<div class="input-group">
35+
<span class="input-group-addon">密码</span>
36+
<input type="password" class="form-control" placeholder="Your password" name="password">
37+
</div>
38+
<br>
39+
<div class="input-group">
40+
<span class="input-group-addon">邮件</span>
41+
<input type="text" class="form-control" placeholder="Your email" name="email">
42+
</div>
43+
<br>
44+
45+
<div class="input-group">
46+
<span class="input-group-addon">头像</span>
47+
<input type="file" class="form-control" placeholder="Your photo" name="image">
48+
</div>
49+
50+
<br>
51+
<div class="input-group">
52+
<span class="input-group-addon">保存</span>
53+
<input type="submit" class="form-control" value="Save">
54+
</div>
55+
<br>
56+
57+
</form>
58+
</div>
59+
</div>
60+
61+
</div>
62+
63+
</body>
64+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<%--
2+
Created by IntelliJ IDEA.
3+
User: jack_bai
4+
Date: 23/04/2018
5+
Time: 11:06 PM
6+
To change this template use File | Settings | File Templates.
7+
--%>
8+
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
9+
<html>
10+
<head>
11+
<title>World Outside</title>
12+
</head>
13+
<body>
14+
15+
</body>
16+
</html>

src/main/webapp/index.jsp

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
1717
});
1818
19+
function toRegisterPage() {
20+
window.self.location="toRegisterPage";
21+
}
22+
1923
function checkLogin() {
2024
$.ajax("/getUserSession", {
2125
data: null,
@@ -35,7 +39,7 @@
3539
function logControl() {
3640
var currentStatus = $("#login").html();
3741
38-
if (currentStatus == "登录") {
42+
if (currentStatus === "登录") {
3943
$('#myModal').modal('show');
4044
} else {
4145
$.ajax({
@@ -92,8 +96,8 @@
9296
</p>
9397

9498
<ul class="nav navbar-nav navbar-right">
95-
<li><a href="/account/edit">世界很大</a></li>
96-
<li><a href="/account/edit">我的钱包</a></li>
99+
<li><a href="/worldBig/edit">世界很大</a></li>
100+
<li><a href="/wallet/edit">我的钱包</a></li>
97101
<li><a href="/account/edit">我的账户</a></li>
98102
</ul>
99103

@@ -132,7 +136,7 @@
132136
<!-- 模态框(Modal) -->
133137
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
134138
style="margin-top: 120px">
135-
<form class="bs-example bs-example-form" role="form" action="/loginHere" method="get">
139+
<form class="bs-example bs-example-form" role="form" action="/loginHere" method="post">
136140
<div class="modal-dialog">
137141
<div class="modal-content">
138142
<div class="modal-header">
@@ -163,7 +167,7 @@
163167
</div>
164168

165169
<div class="modal-footer">
166-
<input type="button" class="btn btn-primary" value="注册" style="margin-right: 10px">
170+
<input type="button" class="btn btn-primary" value="注册" onclick="toRegisterPage()" style="margin-right: 10px">
167171
<input type="submit" value="登录" class="btn btn-primary" style="margin-right: 10px"
168172
/>
169173
<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
@@ -193,8 +197,28 @@
193197
</div>
194198

195199

200+
<div class="modal fade" id="alertInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true"
201+
style="margin-top: 120px" >
202+
<div class="modal-dialog">
203+
<div class="modal-content">
204+
<div class="modal-header">
205+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
206+
&times;
207+
</button>
208+
<h4 class="modal-title" id="alertInfoDialog">
209+
警告
210+
</h4>
211+
</div>
212+
213+
<div class="alert alert-warning">
214+
<strong><p>页面请求出错了!</p></strong>
215+
</div>
216+
</div>
217+
</div>
218+
</div>
219+
220+
221+
196222
</body>
197-
<%--<script src="/lib/jQuery/jquery-3.2.1.min.js"/>--%>
198-
<%--<script src="/lib/bootstrap-3.3.7-dist/js/bootstrap.min.js"/>--%>
199223

200224
</html>

0 commit comments

Comments
 (0)