Compare commits
7 Commits
642cd7ee69
...
336adf0dec
| Author | SHA1 | Date | |
|---|---|---|---|
| 336adf0dec | |||
| 52fe77a5b4 | |||
| ac85c2dc23 | |||
| 8282331339 | |||
| 1759c45fea | |||
| 44ac862bdb | |||
| ed7a3a67b7 |
@@ -25,6 +25,8 @@ public class GoalModel {
|
|||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
private Integer achievementRate; // 達成率
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
|
private Integer currentAmount; // 現在の資産
|
||||||
|
|
||||||
public static GoalModel convertFrom(GoalEntity goalEntity) {
|
public static GoalModel convertFrom(GoalEntity goalEntity) {
|
||||||
return new GoalModel(
|
return new GoalModel(
|
||||||
@@ -34,7 +36,7 @@ public class GoalModel {
|
|||||||
goalEntity.getTargetAmount(),
|
goalEntity.getTargetAmount(),
|
||||||
goalEntity.getDeadline(),
|
goalEntity.getDeadline(),
|
||||||
goalEntity.getGoalComplete(),
|
goalEntity.getGoalComplete(),
|
||||||
null);
|
null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalEntity convertTo(GoalModel goalModel) {
|
public static GoalEntity convertTo(GoalModel goalModel) {
|
||||||
@@ -56,7 +58,7 @@ public class GoalModel {
|
|||||||
goalForm.getTargetAmount(),
|
goalForm.getTargetAmount(),
|
||||||
goalForm.getDeadline(),
|
goalForm.getDeadline(),
|
||||||
goalForm.getGoalComplete()
|
goalForm.getGoalComplete()
|
||||||
,null);
|
,null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,8 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete(),
|
goalModel.getGoalComplete(),
|
||||||
achievementRate);
|
achievementRate,
|
||||||
|
currentAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
import com.example.demo.aop.aspect.SessionCheck;
|
|
||||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
import com.example.demo.app.domain.service.AuthenticationService;
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
import com.example.demo.app.presentation.form.AuthenticationForm;
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -22,7 +22,6 @@ public class AuthenticationController {
|
|||||||
private final AuthenticationService authenticationService;
|
private final AuthenticationService authenticationService;
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
@SessionCheck
|
|
||||||
@GetMapping("/authentication")
|
@GetMapping("/authentication")
|
||||||
public String showAuthentication(Model model) {
|
public String showAuthentication(Model model) {
|
||||||
|
|
||||||
@@ -32,7 +31,6 @@ public class AuthenticationController {
|
|||||||
return "authentication";
|
return "authentication";
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
|
||||||
@PostMapping("/authentication")
|
@PostMapping("/authentication")
|
||||||
public String authenticate(
|
public String authenticate(
|
||||||
AuthenticationForm authenticationForm,
|
AuthenticationForm authenticationForm,
|
||||||
@@ -53,6 +51,10 @@ public class AuthenticationController {
|
|||||||
"passwordResetUserId",
|
"passwordResetUserId",
|
||||||
authenticationModel.getUserId());
|
authenticationModel.getUserId());
|
||||||
|
|
||||||
|
model.addAttribute(
|
||||||
|
"passwordResetForm",
|
||||||
|
new PasswordResetForm());
|
||||||
|
|
||||||
return "password_reset";
|
return "password_reset";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.springframework.ui.Model;
|
|||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.PasswordResetService;
|
import com.example.demo.app.domain.service.PasswordResetService;
|
||||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
@@ -25,29 +26,45 @@ public class PasswordResetController {
|
|||||||
|
|
||||||
@PostMapping("/password/reset")
|
@PostMapping("/password/reset")
|
||||||
public String resetPassword(
|
public String resetPassword(
|
||||||
PasswordResetForm passwordResetForm,
|
PasswordResetForm passwordResetForm,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session){
|
HttpSession session){
|
||||||
|
|
||||||
Long userId =
|
Long userId =
|
||||||
(Long) session.getAttribute("passwordResetUserId");
|
(Long) session.getAttribute("passwordResetUserId");
|
||||||
|
|
||||||
if(userId == null) {
|
if (userId == null) {
|
||||||
return "redirect:/login";
|
LoginModel loginUser =
|
||||||
}
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
boolean isReset =
|
if (loginUser != null) {
|
||||||
passwordResetService.resetPassword(userId, passwordResetForm);
|
userId = loginUser.getUserId();
|
||||||
|
}
|
||||||
if(!isReset) {
|
}
|
||||||
model.addAttribute("Message", "パスワードが一致しません。");
|
|
||||||
return "password_reset";
|
if (userId == null) {
|
||||||
}
|
return "redirect:/login";
|
||||||
|
}
|
||||||
session.removeAttribute("passwordResetUserId");
|
|
||||||
|
boolean isReset =
|
||||||
return "redirect:/login";
|
passwordResetService.resetPassword(userId, passwordResetForm);
|
||||||
|
|
||||||
|
System.out.println("isReset=" + isReset);
|
||||||
|
|
||||||
|
if(!isReset) {
|
||||||
|
model.addAttribute("Message", "パスワードが一致しません。");
|
||||||
|
return "password_reset";
|
||||||
|
}
|
||||||
|
|
||||||
|
session.removeAttribute("passwordResetUserId");
|
||||||
|
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
if (loginUser != null) {
|
||||||
|
return "redirect:/menu";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "redirect:/login";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -344,6 +344,8 @@ public class TransactionController {
|
|||||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
model.addAttribute("achievementRate", goalForm.getAchievementRate());
|
model.addAttribute("achievementRate", goalForm.getAchievementRate());
|
||||||
|
|
||||||
|
model.addAttribute("currentAmount", goalForm.getCurrentAmount());
|
||||||
|
|
||||||
model.addAttribute("targetAmount", goalForm.getTargetAmount());
|
model.addAttribute("targetAmount", goalForm.getTargetAmount());
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class AuthenticationForm {
|
public class AuthenticationForm {
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
private Integer secretQuestionId;
|
private Long secretQuestionId;
|
||||||
private String secretAnswer;
|
private String secretAnswer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public class GoalForm {
|
|||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
private Integer achievementRate; // 達成率
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
|
private Integer currentAmount; // 現在の資産
|
||||||
|
|
||||||
public static GoalForm convertFrom(GoalModel goalModel) {
|
public static GoalForm convertFrom(GoalModel goalModel) {
|
||||||
return new GoalForm(
|
return new GoalForm(
|
||||||
@@ -38,7 +40,8 @@ public class GoalForm {
|
|||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete(),
|
goalModel.getGoalComplete(),
|
||||||
goalModel.getAchievementRate());
|
goalModel.getAchievementRate(),
|
||||||
|
goalModel.getCurrentAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
|
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
<h1>目標詳細</h1>
|
<h1>目標詳細</h1>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"></td>
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
|
|||||||
@@ -118,6 +118,13 @@
|
|||||||
<span th:text="${targetAmount}"></span>
|
<span th:text="${targetAmount}"></span>
|
||||||
<span>円</span>
|
<span>円</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>現在高</span>
|
||||||
|
<span th:text="${currentAmount}"></span>
|
||||||
|
<span>円</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span>貯金額</span>
|
<span>貯金額</span>
|
||||||
<span th:text="${saving}"></span>
|
<span th:text="${saving}"></span>
|
||||||
|
|||||||
@@ -4,14 +4,15 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>パスワード再設定</title>
|
<title>パスワード再設定</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="pb-5 pt-5">
|
<body>
|
||||||
<div th:replace="~{header :: header}">
|
<!--<body class="pb-5 pt-5">-->
|
||||||
</div>
|
<!-- <div th:replace="~{header :: header}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>パスワード再設定</h1>
|
<h1>パスワード再設定</h1>
|
||||||
|
|
||||||
<form th:action="@{/password_reset}" th:object="${passwordResetForm}" method="post">
|
<form th:action="@{/password/reset}" th:object="${passwordResetForm}" method="post">
|
||||||
<div>
|
<div>
|
||||||
<label for="password">新しいパスワード</label>
|
<label for="password">新しいパスワード</label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
@@ -35,8 +36,8 @@
|
|||||||
<button type="submit">再設定</button>
|
<button type="submit">再設定</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div th:if="${errorMessage}">
|
<div th:if="${Message}">
|
||||||
<p th:text="${errorMessage}"></p>
|
<p th:text="${Message}"></p>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user