From 65290c018971e61f6262f38be935195645c18018 Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 14:38:00 +0900 Subject: [PATCH 01/18] =?UTF-8?q?[STYLE]=20body=E3=81=AE=E9=96=93=E9=9A=94?= =?UTF-8?q?=E3=82=92=E8=AA=BF=E6=95=B4=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/transaction_detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/transaction_detail.html b/src/main/resources/templates/transaction_detail.html index 93a352c..69a14e1 100644 --- a/src/main/resources/templates/transaction_detail.html +++ b/src/main/resources/templates/transaction_detail.html @@ -10,7 +10,7 @@ - +
From 1438c944065d072f147fc5dae722f28f95e03a4c Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 14:38:21 +0900 Subject: [PATCH 02/18] =?UTF-8?q?[STYLE]=20=E7=9B=AE=E6=A8=99=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E7=94=BB=E9=9D=A2=E3=81=AECSS=E7=B5=90=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/goal_create.html | 70 +++++++++++-------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/main/resources/templates/goal_create.html b/src/main/resources/templates/goal_create.html index fe201e4..a97384f 100644 --- a/src/main/resources/templates/goal_create.html +++ b/src/main/resources/templates/goal_create.html @@ -1,46 +1,56 @@ - - - 目標作成 - - + + + 目標作成 + + + - - + + +
-

目標作成

+
-
- +

目標作成

-
- - -
+
-
- - -
+
-
- - -
+ + -
- - -
- +
+ + +
- +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
-
- + \ No newline at end of file From 073ee12f030a299e35228ec1e5c62e56b7c37b8a Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 14:38:38 +0900 Subject: [PATCH 03/18] =?UTF-8?q?[STYLE]=20=E3=82=B0=E3=83=A9=E3=83=95?= =?UTF-8?q?=E3=81=AA=E3=81=A9=E3=81=AECSS=E7=B5=90=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/goal_view.html | 108 ++++++++++---------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/src/main/resources/templates/goal_view.html b/src/main/resources/templates/goal_view.html index 719d946..a7b89ea 100644 --- a/src/main/resources/templates/goal_view.html +++ b/src/main/resources/templates/goal_view.html @@ -31,8 +31,10 @@
-
- +
+
+ +
@@ -81,6 +83,7 @@ options: { responsive: true, + maintainAspectRatio: false, scales: { @@ -101,21 +104,22 @@ -
-
    +
      -
    • +
    • -
      +
      +
      - - +
      +
      + @@ -125,10 +129,12 @@ + + @@ -138,61 +144,57 @@ +
      目標名 目標説明
      目標金額
      目標達成期限 達成率
      -
      +
      -
      + + +
+ +
+ +
+ + + +
+ +
+ + + +
+ +
+ + -
+ -
+
- + - + - + +
+ - - - - - - -
- -
- - - - - -
- - -
- - - -
-
- - - -
- - -
+ +
+
From 29749c444ae79184343d99b764212b9df3933fc0 Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 14:39:03 +0900 Subject: [PATCH 04/18] =?UTF-8?q?[HOTFIX]=20=E7=9B=AE=E6=A8=99=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88=E3=80=81?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TransactionController.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java index 0b0984b..50addac 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java @@ -378,18 +378,33 @@ public class TransactionController { List resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0) .collect(Collectors.toList()); + GoalForm result = new GoalForm(); + + if (resultList.getFirst() != null) { + result = resultList.getFirst(); + model.addAttribute("achievementRate", result.getAchievementRate()); - GoalForm result = resultList.getFirst(); + model.addAttribute("currentAmount", result.getCurrentAmount()); - model.addAttribute("achievementRate", result.getAchievementRate()); + model.addAttribute("targetAmount", result.getTargetAmount()); - model.addAttribute("currentAmount", result.getCurrentAmount()); + model.addAttribute("saving", userForm.getSaving()); - model.addAttribute("targetAmount", result.getTargetAmount()); + model.addAttribute("deadline", result.getDeadline()); - model.addAttribute("saving", userForm.getSaving()); + } else { + model.addAttribute("achievementRate", "目標を設定してください"); + + model.addAttribute("currentAmount", "目標を設定してください"); + + model.addAttribute("targetAmount", "目標を設定してください"); + + model.addAttribute("saving", userForm.getSaving()); + + model.addAttribute("deadline", "目標を設定してください"); + + } - model.addAttribute("deadline", result.getDeadline()); return "menu"; } From a0ef7145d294e1759d7438cac2562a9ccb454ff9 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Fri, 25 Sep 2026 14:58:09 +0900 Subject: [PATCH 05/18] =?UTF-8?q?[FIX]=20=E5=AE=9A=E6=95=B0=E3=82=AF?= =?UTF-8?q?=E3=83=A9=E3=82=B9=E3=81=AE=E8=AA=A4=E5=AD=97=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pageproperty/PageReturnAttributeKeyword.java | 2 +- .../TransitionTargetPageNameKeyword.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java index a6934c5..c5b6eea 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java +++ b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java @@ -14,7 +14,7 @@ public class PageReturnAttributeKeyword { public static final String PASSWOR_RESET_FORM = "passwordResetForm"; public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId"; - public static final String AUTENTICATION_FORM = "authenticationForm"; + public static final String AUTHENTICATION_FORM = "authenticationForm"; public static final String PROFILE_FORM = "profileForm"; public static final String PROFILE_EDIT_FORM = "profileEditForm"; diff --git a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/TransitionTargetPageNameKeyword.java b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/TransitionTargetPageNameKeyword.java index a7ce259..3249dee 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/TransitionTargetPageNameKeyword.java +++ b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/TransitionTargetPageNameKeyword.java @@ -5,13 +5,13 @@ public class TransitionTargetPageNameKeyword { // HTML public static final String ERROR_HTML = "error"; - public static final String USER_RESISTER_HTML = "user_resiter"; - public static final String USER_RESISTER_RETURN_HTML = "user_resiter_return"; - public static final String USER_RESISTER_CONFIRM_HTML = "user_resiter_confirm"; + public static final String USER_RESISTER_HTML = "user_register"; + public static final String USER_RESISTER_RETURN_HTML = "user_register_return"; + public static final String USER_RESISTER_CONFIRM_HTML = "user_register_confirm"; public static final String LOGIN_HTML = "login"; - public static final String PASSWORD_RESET_HTML = "passsword_reset"; + public static final String PASSWORD_RESET_HTML = "password_reset"; public static final String AUTHENTICATION_HTML = "authentication"; @@ -47,7 +47,7 @@ public class TransitionTargetPageNameKeyword { public static final String AUTHENTICATION = "/authentication"; - public static final String PASSWORD_RESET = "/passsword/reset"; + public static final String PASSWORD_RESET = "/password/reset"; public static final String MENU = "/menu"; @@ -65,12 +65,13 @@ public class TransitionTargetPageNameKeyword { public static final String TRANSACTION_DETAIL = "/transaction/detail"; public static final String TRANSACTION_CREATE = "/transaction/create"; public static final String TRANSACTION_UPDATE = "/transaction/update"; + public static final String TRANSACTION_DELETE = "/transaction/delete"; public static final String TODAY_DATES = "todayDates"; public static final String ANALYSIS = "/analysis"; public static final String GOAL = "/goal"; - public static final String GOAL_EDIT = "/goal/edit"; - public static final String GOAL_UPDATE = "/goal/update"; + public static final String EDIT = "/edit"; + public static final String UPDATE = "/update"; } From ff21efa943799a8b9b43d58660dbaf6fce2953f0 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Fri, 25 Sep 2026 14:59:27 +0900 Subject: [PATCH 06/18] =?UTF-8?q?[EDIT]=20=E5=85=A8=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=AD=E3=83=BC=E3=83=A9=E3=81=AB=E5=AE=9A=E6=95=B0?= =?UTF-8?q?=E3=82=92=E5=8F=8D=E6=98=A0=E3=81=95=E3=81=9B=E3=81=BE=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AnalysisController.java | 23 +-- .../controller/AuthenticationController.java | 24 ++-- .../controller/CourseController.java | 41 +++--- .../controller/ErrorController.java | 6 +- .../controller/GoalController.java | 27 ++-- .../controller/LoginController.java | 19 +-- .../controller/PasswordResetController.java | 34 +++-- .../controller/ProfileController.java | 35 ++--- .../controller/TransactionController.java | 134 ++++++++++-------- .../controller/UserController.java | 42 +++--- 10 files changed, 211 insertions(+), 174 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/AnalysisController.java b/src/main/java/com/example/demo/app/presentation/controller/AnalysisController.java index b64f7ae..ffa5d88 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/AnalysisController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/AnalysisController.java @@ -13,6 +13,9 @@ import com.example.demo.aop.aspect.SessionCheck; import com.example.demo.app.domain.model.AnalysisModel; import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.service.AnalysisService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.AnalysisForm; import lombok.RequiredArgsConstructor; @@ -25,7 +28,7 @@ public class AnalysisController { private final AnalysisService analysisService; @SessionCheck - @GetMapping("/analysis") + @GetMapping(TransitionTargetPageNameKeyword.ANALYSIS) public String showAnalysis( @RequestParam(required = false) Integer year, @RequestParam(required = false) Integer month, @@ -33,7 +36,7 @@ public class AnalysisController { HttpSession session) { //ログインユーザーの取得(セッション) - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); //初期年月表示 LocalDate nowDate = LocalDate.now(); @@ -58,15 +61,15 @@ public class AnalysisController { AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel); //model格納 - model.addAttribute("analysisForm", analysisForm); - model.addAttribute("year", year); - model.addAttribute("month", month); - model.addAttribute("previousYear", previousDate.getYear()); - model.addAttribute("previousMonth", previousDate.getMonthValue()); - model.addAttribute("nextYear", nextDate.getYear()); - model.addAttribute("nextMonth", nextDate.getMonthValue()); + model.addAttribute(PageReturnAttributeKeyword.ANALYSIS_FORM, analysisForm); + model.addAttribute(PageReturnAttributeKeyword.YEAR, year); + model.addAttribute(PageReturnAttributeKeyword.MONTH, month); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousDate.getYear()); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousDate.getMonthValue()); + model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextDate.getYear()); + model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextDate.getMonthValue()); - return "analysis"; + return TransitionTargetPageNameKeyword.ANALYSIS_HTML; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/AuthenticationController.java b/src/main/java/com/example/demo/app/presentation/controller/AuthenticationController.java index 504e991..71187ca 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/AuthenticationController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/AuthenticationController.java @@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping; import com.example.demo.app.domain.model.AuthenticationModel; import com.example.demo.app.domain.service.AuthenticationService; import com.example.demo.app.infra.repository.QuestionRepository; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.AuthenticationForm; import com.example.demo.app.presentation.form.PasswordResetForm; @@ -22,16 +24,16 @@ public class AuthenticationController { private final AuthenticationService authenticationService; private final QuestionRepository questionRepository; - @GetMapping("/authentication") + @GetMapping(TransitionTargetPageNameKeyword.AUTHENTICATION) public String showAuthentication(Model model) { - model.addAttribute("authenticationForm", new AuthenticationForm()); - model.addAttribute("questionList", questionRepository.findAll()); + model.addAttribute(PageReturnAttributeKeyword.AUTHENTICATION_FORM, new AuthenticationForm()); + model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll()); - return "authentication"; + return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML; } - @PostMapping("/authentication") + @PostMapping(TransitionTargetPageNameKeyword.AUTHENTICATION) public String authenticate( AuthenticationForm authenticationForm, Model model, @@ -41,21 +43,21 @@ public class AuthenticationController { authenticationService.authenticate(authenticationForm); if (authenticationModel == null) { - model.addAttribute("errorMessage", "認証情報が正しくありません。"); - model.addAttribute("questionList", questionRepository.findAll()); + model.addAttribute(PageReturnAttributeKeyword.ERROR_MESSAGE, "認証情報が正しくありません。"); + model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll()); - return "authentication"; + return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML; } session.setAttribute( - "passwordResetUserId", + PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID, authenticationModel.getUserId()); model.addAttribute( - "passwordResetForm", + PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm()); - return "password_reset"; + return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/CourseController.java b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java index ccc83d9..49b99d1 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/CourseController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java @@ -14,6 +14,9 @@ import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.service.CourseInfoService; import com.example.demo.app.domain.service.CourseService; import com.example.demo.app.domain.service.UserService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.CourseForm; import com.example.demo.app.presentation.form.CourseInfoForm; import com.example.demo.app.presentation.form.UserForm; @@ -30,51 +33,53 @@ public class CourseController { private final UserService userService; - @PostMapping("/user/register/course") + @PostMapping(TransitionTargetPageNameKeyword.SHOW_SELECT_COURSE) public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) { + final String MODE = "regist"; + final String DEFAULT = "バランスコース"; - - session.setAttribute("userForm", userForm); - model.addAttribute("mode", "regist"); - model.addAttribute("currentCourseId", courseService.findByName("バランスコース")); - model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); - model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm); + model.addAttribute(PageReturnAttributeKeyword.MODE, MODE); + model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT)); + model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll())); + model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST, CourseInfoForm.convertFrom(courseInfoService.findAll())); - return "select_course"; + return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML; } @SessionCheck - @GetMapping("/course") + @GetMapping(TransitionTargetPageNameKeyword.COURSE) public String showChangeCourse(Model model, HttpSession session) { + final String MODE = "change"; - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); Long userId = loginUser.getUserId(); Long currentCourseId = userService.findByUserId(userId).getCourseId(); - model.addAttribute("mode", "change"); - model.addAttribute("currentCourseId", currentCourseId); - model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); - model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + model.addAttribute(PageReturnAttributeKeyword.MODE, MODE); + model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId); + model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll())); + model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST, CourseInfoForm.convertFrom(courseInfoService.findAll())); - return "select_course"; + return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML; } @SessionCheck - @PostMapping("/change") + @PostMapping(TransitionTargetPageNameKeyword.CHANGE) public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) { - LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) httpSession.getAttribute(SessionKeyword.LOGIN_USER); userService.updateCourse(loginUser.getUserId(), courseId); - return "redirect:/menu"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU; } diff --git a/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java b/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java index 973d396..89bf805 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java @@ -3,10 +3,12 @@ package com.example.demo.app.presentation.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; + @Controller public class ErrorController { - @GetMapping("/error") + @GetMapping(TransitionTargetPageNameKeyword.ERROR) public String showError() { - return "error"; + return TransitionTargetPageNameKeyword.ERROR_HTML; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java index 856d77b..30e7f54 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java @@ -13,13 +13,16 @@ import com.example.demo.aop.aspect.SessionCheck; import com.example.demo.app.domain.model.GoalModel; import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.service.GoalService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.GoalForm; import lombok.RequiredArgsConstructor; @Controller @RequiredArgsConstructor -@RequestMapping("/goal") +@RequestMapping(TransitionTargetPageNameKeyword.GOAL) public class GoalController { private final GoalService goalService; @@ -28,36 +31,36 @@ public class GoalController { @GetMapping("") public String getGoal(Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); Long userId = loginUser.getUserId(); GoalModel goalModel = goalService.getGoalByUserId(userId); GoalForm goalForm = GoalForm.convertFrom(goalModel); - model.addAttribute("goalForm", goalForm); - return "goal_view"; + model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm); + return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML; } @SessionCheck - @GetMapping("/edit") + @GetMapping(TransitionTargetPageNameKeyword.EDIT) public String editGoal(Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); Long userId = loginUser.getUserId(); GoalModel goalModel = goalService.getGoalByUserId(userId); GoalForm goalForm = GoalForm.convertFrom(goalModel); - model.addAttribute("goalForm", goalForm); - return "goal_edit"; + model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm); + return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML; } @SessionCheck - @PostMapping("/update") + @PostMapping(TransitionTargetPageNameKeyword.UPDATE) public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); Long userId = loginUser.getUserId(); @@ -65,13 +68,13 @@ public class GoalController { GoalModel currentGoal = goalService.getGoalByUserId(userId); if (!currentGoal.getGoalId().equals(goalForm.getGoalId())) { - return "redirect:/goal"; // 他人のデータを更新しようとしたら弾く + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL; // 他人のデータを更新しようとしたら弾く } GoalModel goalModel = GoalModel.convertFrom(goalForm); goalService.updateGoal(goalModel); - return "redirect:/goal"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL; } } \ No newline at end of file diff --git a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java index 53cf92f..9d85036 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java @@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.PostMapping; import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.service.LoginService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.LoginForm; import lombok.RequiredArgsConstructor; @@ -20,13 +23,13 @@ public class LoginController { private final LoginService loginService; - @GetMapping("/login") + @GetMapping(TransitionTargetPageNameKeyword.LOGIN) public String showLogin(@ModelAttribute LoginForm loginForm) { - return "login"; + return TransitionTargetPageNameKeyword.LOGIN_HTML; } - @PostMapping("/login") + @PostMapping(TransitionTargetPageNameKeyword.LOGIN) public String login( @ModelAttribute LoginForm loginForm, Model model, @@ -38,15 +41,15 @@ public class LoginController { if (loginModel == null) { model.addAttribute( - "errorMessage", - "Email address or password is incorrect."); + PageReturnAttributeKeyword.ERROR_MESSAGE, + "IDまたはパスワードが間違っています."); - return "login"; + return TransitionTargetPageNameKeyword.LOGIN_HTML; } - session.setAttribute("loginUser", loginModel); + session.setAttribute(SessionKeyword.LOGIN_USER, loginModel); - return "redirect:/menu"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java b/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java index 46d8b08..a6d9798 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java @@ -9,6 +9,9 @@ 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.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.PasswordResetForm; import lombok.RequiredArgsConstructor; @@ -18,24 +21,24 @@ import lombok.RequiredArgsConstructor; public class PasswordResetController { private final PasswordResetService passwordResetService; - @GetMapping("/password/reset") + @GetMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET) public String showPasswordReset(Model model) { - model.addAttribute("passwordResetForm", new PasswordResetForm()); - return "password_reset"; + model.addAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm()); + return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML; } - @PostMapping("/password/reset") + @PostMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET) public String resetPassword( PasswordResetForm passwordResetForm, Model model, HttpSession session){ Long userId = - (Long) session.getAttribute("passwordResetUserId"); + (Long) session.getAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID); if (userId == null) { LoginModel loginUser = - (LoginModel) session.getAttribute("loginUser"); + (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); if (loginUser != null) { userId = loginUser.getUserId(); @@ -43,28 +46,29 @@ public class PasswordResetController { } if (userId == null) { - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.LOGIN; } boolean isReset = passwordResetService.resetPassword(userId, passwordResetForm); - System.out.println("isReset=" + isReset); - if(!isReset) { - model.addAttribute("message", "パスワードが一致しません。"); - return "password_reset"; + model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "パスワードが一致しません。"); + return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML; } - session.removeAttribute("passwordResetUserId"); + session.removeAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID); LoginModel loginUser = - (LoginModel) session.getAttribute("loginUser"); + (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); if (loginUser != null) { - return "redirect:/menu"; + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.MENU; } - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.LOGIN; } } \ No newline at end of file diff --git a/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java b/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java index ef10a10..a78c133 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java @@ -12,6 +12,9 @@ import com.example.demo.aop.aspect.SessionCheck; import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.model.ProfileModel; import com.example.demo.app.domain.service.ProfileService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.ProfileEditForm; import com.example.demo.app.presentation.form.ProfileForm; @@ -23,26 +26,26 @@ public class ProfileController { private final ProfileService profileService; @SessionCheck - @GetMapping("/profile") + @GetMapping(TransitionTargetPageNameKeyword.PROFILE) public String profile(Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); ProfileModel profileModel = profileService.findOne(loginUser.getUserId()); ProfileForm profileForm = ProfileForm.convertForm(profileModel); - model.addAttribute("profileForm", profileForm); - return "profile"; + model.addAttribute(PageReturnAttributeKeyword.PROFILE_FORM, profileForm); + return TransitionTargetPageNameKeyword.PROFILE_HTML; } @SessionCheck - @GetMapping("/profile/edit") + @GetMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT) public String showEditProfile( Model model, HttpSession session) { LoginModel loginUser = - (LoginModel) session.getAttribute("loginUser"); + (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); ProfileModel profileModel = profileService.findOne(loginUser.getUserId()); @@ -55,42 +58,42 @@ public class ProfileController { profileModel.getAnnualIncome(), profileModel.getMonthlyBudget()); - model.addAttribute("profileEditForm", profileEditForm); - return "profile_edit"; + model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm); + return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML; } - @PostMapping("/profile/edit") + @PostMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT) public String updateProfile( @ModelAttribute ProfileEditForm profileEditForm, HttpSession session) { LoginModel loginUser = - (LoginModel) session.getAttribute("loginUser"); + (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); profileService.update( loginUser.getUserId(), profileEditForm); - return "redirect:/profile"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.PROFILE; } - @PostMapping("/withdraw") + @PostMapping(TransitionTargetPageNameKeyword.WITHDRAW) public String withdraw(HttpSession session) { LoginModel loginUser = - (LoginModel) session.getAttribute("loginUser"); + (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); profileService.withdraw(loginUser.getUserId()); session.invalidate(); - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN; } - @PostMapping("/logout") + @PostMapping(TransitionTargetPageNameKeyword.LOGOUT) public String logout(HttpSession session) { session.invalidate(); - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java index 4897ccb..cec039e 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java @@ -23,6 +23,9 @@ import com.example.demo.app.domain.service.CategoryService; import com.example.demo.app.domain.service.GoalService; import com.example.demo.app.domain.service.TransactionService; import com.example.demo.app.domain.service.UserService; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.CategoryForm; import com.example.demo.app.presentation.form.Expense; import com.example.demo.app.presentation.form.GoalForm; @@ -43,14 +46,14 @@ public class TransactionController { // 一覧画面 @SessionCheck - @GetMapping("/transaction/list") + @GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_LIST) public String transactionList( @RequestParam(required = false, defaultValue = "0") String years, @RequestParam(required = false, defaultValue = "0") String months, Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); LocalDate today = LocalDate.now(); @@ -111,28 +114,28 @@ public class TransactionController { transactionFormMap.put(date, transactionFormList); }); - model.addAttribute("year", year); - model.addAttribute("month", month); + model.addAttribute(PageReturnAttributeKeyword.YEAR, year); + model.addAttribute(PageReturnAttributeKeyword.MONTH, month); - model.addAttribute("previousYear", previousYear); - model.addAttribute("previousMonth", previousMonth); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth); - model.addAttribute("nextYear", nextYear); - model.addAttribute("nextMonth", nextMonth); + model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear); + model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth); - model.addAttribute("transactionFormMap", transactionFormMap); + model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_MAP, transactionFormMap); - return "transaction_list"; + return TransitionTargetPageNameKeyword.TRANSACTION_LIST_HTML; } // 詳細画面 @SessionCheck - @GetMapping("/transaction/detail") + @GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_DETAIL) public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) { LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates; - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); List transactionFormList = transactionService .findByUserIdAndDate(todayDate, loginUser.getUserId()).stream() @@ -173,14 +176,14 @@ public class TransactionController { return transactionForm; }).collect(Collectors.toList()); - model.addAttribute("today", todayDate); - model.addAttribute("transactionFormList", transactionFormList); + model.addAttribute(PageReturnAttributeKeyword.TODAY, todayDate); + model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_LIST, transactionFormList); - return "transaction_detail"; + return TransitionTargetPageNameKeyword.TRANSACTION_DETAIL_HTML; } @SessionCheck - @GetMapping("/transaction/create") + @GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE) public String createOneGet(@RequestParam(defaultValue = "") LocalDate today, Model model) { @@ -193,35 +196,38 @@ public class TransactionController { TransactionForm transactionForm = new TransactionForm(); transactionForm.setTransactionDate(today); - System.out.println(transactionForm.getCategoryName() + " " + transactionForm.getAmount()); + model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm); - model.addAttribute("transactionForm", transactionForm); + model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList); - model.addAttribute("categoryFormList", categoryFormList); + model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE)); - model.addAttribute("today", today.format(DateTimeFormatter.ISO_LOCAL_DATE)); - - return "transaction_create"; + return TransitionTargetPageNameKeyword.TRANSACTION_CREATE_HTML; } @SessionCheck - @PostMapping("/transaction/create") + @PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE) public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); transactionForm.setUserId(loginUser.getUserId()); if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) { - return "error"; + return TransitionTargetPageNameKeyword.ERROR_HTML; } - return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate(); + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.TRANSACTION_DETAIL + + TransitionTargetPageNameKeyword.INTERROGATION + + TransitionTargetPageNameKeyword.TODAY_DATES + + TransitionTargetPageNameKeyword.EQUAL + + transactionForm.getTransactionDate(); } @SessionCheck - @GetMapping("/transaction/update") + @GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE) public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today, Model model) { @@ -238,22 +244,20 @@ public class TransactionController { transactionService.findMoneyRecord(transactionId), CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType()); - System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount()); + model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId); - model.addAttribute("transactionId", transactionId); + model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm); - model.addAttribute("transactionForm", transactionForm); + model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList); - model.addAttribute("categoryFormList", categoryFormList); + model.addAttribute(PageReturnAttributeKeyword.TODAY, today); - model.addAttribute("today", today); - - return "transaction_update"; + return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML; } @SessionCheck - @PostMapping("/transaction/update") + @PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE) public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, Model model, HttpSession session) { @@ -264,28 +268,38 @@ public class TransactionController { transactionForm.setTransactionId(transactionId); if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) { - return "error"; + return TransitionTargetPageNameKeyword.ERROR_HTML; } - return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate(); + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.TRANSACTION_DETAIL + + TransitionTargetPageNameKeyword.INTERROGATION + + TransitionTargetPageNameKeyword.TODAY_DATES + + TransitionTargetPageNameKeyword.EQUAL + + transactionForm.getTransactionDate(); } @SessionCheck - @PostMapping("/transaction/delete") + @PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_DELETE) public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) { transactionService.deleteTransaction(transactionId); - return "redirect:/transaction/detail?todayDates=" + today; + return TransitionTargetPageNameKeyword.REDIRECT + + TransitionTargetPageNameKeyword.TRANSACTION_DETAIL + + TransitionTargetPageNameKeyword.INTERROGATION + + TransitionTargetPageNameKeyword.TODAY_DATES + + TransitionTargetPageNameKeyword.EQUAL + + today; } @SessionCheck - @GetMapping("/menu") + @GetMapping(TransitionTargetPageNameKeyword.MENU) public String menu(HttpSession session, Model model, @RequestParam(required = false, defaultValue = "0") String years, @RequestParam(required = false, defaultValue = "0") String months) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER); LocalDate today = LocalDate.now(); @@ -309,18 +323,18 @@ public class TransactionController { int nextYear = nextYearMonth.getYear(); int nextMonth = nextYearMonth.getMonthValue(); - model.addAttribute("year", year); - model.addAttribute("month", month); - model.addAttribute("day", today.getDayOfMonth()); + model.addAttribute(PageReturnAttributeKeyword.YEAR, year); + model.addAttribute(PageReturnAttributeKeyword.MONTH, month); + model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth()); - model.addAttribute("lastDay", lastDay); - model.addAttribute("firstDayOfWeek", firstDayOfWeek); + model.addAttribute(PageReturnAttributeKeyword.LAST_DAY, lastDay); + model.addAttribute(PageReturnAttributeKeyword.FIRST_DAY_OF_WEEK, firstDayOfWeek); - model.addAttribute("previousYear", previousYear); - model.addAttribute("previousMonth", previousMonth); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear); + model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth); - model.addAttribute("nextYear", nextYear); - model.addAttribute("nextMonth", nextMonth); + model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear); + model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth); LocalDate startDate = yearMonth.atDay(1); LocalDate endDate = yearMonth.atEndOfMonth(); @@ -329,31 +343,31 @@ public class TransactionController { List expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId()); - model.addAttribute("incomeList", incomeList); - model.addAttribute("expenseList", expenseList); + model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList); + model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList); int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId()); int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId()); - model.addAttribute("totalIncome", totalIncome); - model.addAttribute("totalExpense", totalExpense); + model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome); + model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense); GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId())); UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId())); - model.addAttribute("achievementRate", goalForm.getAchievementRate()); + model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, goalForm.getAchievementRate()); - model.addAttribute("currentAmount", goalForm.getCurrentAmount()); + model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, goalForm.getCurrentAmount()); - model.addAttribute("targetAmount", goalForm.getTargetAmount()); + model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, goalForm.getTargetAmount()); - model.addAttribute("saving", userForm.getSaving()); + model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving()); - model.addAttribute("deadline", goalForm.getDeadline()); + model.addAttribute(PageReturnAttributeKeyword.DEADLINE, goalForm.getDeadline()); - return "menu"; + return TransitionTargetPageNameKeyword.MENU_HTML; } } diff --git a/src/main/java/com/example/demo/app/presentation/controller/UserController.java b/src/main/java/com/example/demo/app/presentation/controller/UserController.java index d009d29..ebfc930 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/UserController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/UserController.java @@ -15,6 +15,8 @@ import com.example.demo.app.domain.service.CourseService; import com.example.demo.app.domain.service.QuestionService; import com.example.demo.app.domain.service.UserService; import com.example.demo.app.infra.entity.QuestionEntity; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.UserForm; import lombok.RequiredArgsConstructor; @@ -30,64 +32,60 @@ public class UserController { private final QuestionService questionService; - @GetMapping("/user/register") + @GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER) public String showRegister(Model model, HttpSession session) { UserForm userForm = new UserForm(); List questionList = questionService.findAll(); - session.setAttribute("questionList", questionList); + session.setAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionList); - model.addAttribute("userForm", userForm); - return "user_register"; + model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm); + return TransitionTargetPageNameKeyword.USER_RESISTER_HTML; } - @PostMapping("/user/register/return") + @PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_RETURN) public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) { - UserForm userForm = (UserForm) session.getAttribute("userForm"); - System.out.println( - "######################################################################3" + userForm.getBirthDate()); - + UserForm userForm = (UserForm) session.getAttribute(PageReturnAttributeKeyword.USER_FORM); + if (userForm.getUserName().equals("")) { userForm = new UserForm(); userForm.setCourseId(courseId); } if (courseId != null) { - model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName()); + model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName()); } - session.setAttribute("selectedCourseName", courseService.findById(courseId).getCourseName()); - model.addAttribute("courseId", courseId); - System.out.println( - "######################################################################3" + userForm.getBirthDate()); - model.addAttribute("userForm", userForm); + session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName()); + model.addAttribute(PageReturnAttributeKeyword.COURESE_ID, courseId); + model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm); - return "user_register_return"; + return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML; } - @GetMapping("/user/register/confirm") + @GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM) public String confirmRegisterGet(@ModelAttribute UserForm userForm, String selectedCourseName, Model model, HttpSession session) { - model.addAttribute("selectedCourseName", (String) session.getAttribute("selectedCourseName")); - return "user_register_confirm"; + model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName")); + return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML; } - @PostMapping("/user/register/complete") + @PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_COMPLETE) public String confirmRegister( @ModelAttribute UserForm userForm, Model model, HttpSession session) { - Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName")); + Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME)); userService.register(userForm, courseId); - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN; } From cdc5ea21c7c66b5ff008b5d497a80cf90db9cffc Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:12:17 +0900 Subject: [PATCH 07/18] =?UTF-8?q?[EDIT]=20=E3=83=91=E3=82=B9=E3=83=AF?= =?UTF-8?q?=E3=83=BC=E3=83=89=E6=9A=97=E5=8F=B7=E5=8C=96=E3=81=AE=E3=81=9F?= =?UTF-8?q?=E3=82=81=E3=81=AE=E4=BE=9D=E5=AD=98=E6=80=A7=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 3cd9ac2..6b81233 100644 --- a/pom.xml +++ b/pom.xml @@ -83,6 +83,11 @@ spring-boot-starter-webmvc-test test + + org.mindrot + jbcrypt + 0.4 + From b9742d87c002b5b6d263fbfff862902713e83cd9 Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:13:38 +0900 Subject: [PATCH 08/18] =?UTF-8?q?[EDIT]=20=E3=81=84=E3=82=89=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=83=91=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/demo/app/domain/service/UserService.java | 2 +- .../demo/app/presentation/controller/UserController.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/demo/app/domain/service/UserService.java b/src/main/java/com/example/demo/app/domain/service/UserService.java index fa63458..345625e 100644 --- a/src/main/java/com/example/demo/app/domain/service/UserService.java +++ b/src/main/java/com/example/demo/app/domain/service/UserService.java @@ -5,7 +5,7 @@ import com.example.demo.app.presentation.form.UserForm; public interface UserService { - public void register(UserForm userForm, Long courseId, Long userId); + public void register(UserForm userForm, Long courseId); public void updateCourse(Long userId, Long courseId); diff --git a/src/main/java/com/example/demo/app/presentation/controller/UserController.java b/src/main/java/com/example/demo/app/presentation/controller/UserController.java index a4ac2cb..d009d29 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/UserController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/UserController.java @@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; -import com.example.demo.app.domain.model.LoginModel; import com.example.demo.app.domain.service.CourseService; import com.example.demo.app.domain.service.QuestionService; import com.example.demo.app.domain.service.UserService; @@ -84,11 +83,9 @@ public class UserController { Model model, HttpSession session) { - LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); - Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName")); - userService.register(userForm, courseId, loginUser.getUserId()); + userService.register(userForm, courseId); return "redirect:/login"; } From 9872405377d5773716892f2bd856b6ab0b9a656b Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:14:21 +0900 Subject: [PATCH 09/18] =?UTF-8?q?[EDIT]=20=E4=BC=9A=E5=93=A1=E7=99=BB?= =?UTF-8?q?=E9=8C=B2=E3=83=BB=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E3=81=AB?= =?UTF-8?q?=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89=E6=9A=97=E5=8F=B7?= =?UTF-8?q?=E5=8C=96=E6=A9=9F=E8=83=BD=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/service/impl/LoginServiceImpl.java | 30 ++++++++++++------- .../domain/service/impl/UserServiceImpl.java | 11 ++++--- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java index 9e1563a..2ec04b3 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java @@ -1,5 +1,6 @@ package com.example.demo.app.domain.service.impl; +import org.mindrot.jbcrypt.BCrypt; import org.springframework.stereotype.Service; import com.example.demo.app.domain.model.LoginModel; @@ -13,19 +14,26 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class LoginServiceImpl implements LoginService { - private final UserRepository userRepository; + private final UserRepository userRepository; - @Override - public LoginModel login(String mailAddress, String password) { + @Override + public LoginModel login(String mailAddress, String password) { - UserEntity userEntity = userRepository.findByMailAddressAndPassword( - mailAddress, - password).orElse(null); + UserEntity userEntity = userRepository + .findByMailAddress(mailAddress) + .orElse(null); - if (userEntity == null) { - return null; - } + if (userEntity == null) { + return null; + } + + boolean isValidPassword = BCrypt.checkpw(password, userEntity.getPassword()); + + if (!isValidPassword) { + return null; + } + + return new LoginModel(userEntity.getUserId()); + } - return new LoginModel(userEntity.getUserId()); - } } diff --git a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java index 9cc6639..ed6c47f 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java @@ -1,5 +1,6 @@ package com.example.demo.app.domain.service.impl; +import org.mindrot.jbcrypt.BCrypt; import org.springframework.stereotype.Service; import com.example.demo.app.domain.model.UserModel; @@ -24,14 +25,17 @@ public class UserServiceImpl implements UserService { private final GoalRepository goalRepository; private final CourseRepository courseRepository; - @Override - public void register(UserForm userForm, Long courseId, Long userId) { + @Override + public void register(UserForm userForm, Long courseId) { UserEntity userEntity = new UserEntity(); userEntity.setUserName(userForm.getUserName()); userEntity.setMailAddress(userForm.getMailAddress()); - userEntity.setPassword(userForm.getPassword()); + + String passwordHashed = BCrypt.hashpw(userForm.getPassword(), BCrypt.gensalt()); + + userEntity.setPassword(passwordHashed); userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer()); userEntity.setBirthDate(userForm.getBirthDate()); userEntity.setSaving(userForm.getSaving()); @@ -44,7 +48,6 @@ public class UserServiceImpl implements UserService { GoalEntity goalEntity = new GoalEntity(); goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId()))); - goalEntity.setUserEntity(userRepository.findById(userId).get()); CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null); From 2b3cecf55d1b67c239003f3565f784f4d139d48c Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:14:39 +0900 Subject: [PATCH 10/18] =?UTF-8?q?[FIX]=20=E7=9B=AE=E6=A8=99=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E4=BA=BA=E3=81=AF=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=83=90=E3=82=B0?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TransactionController.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java index 50addac..a6baff2 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java @@ -378,34 +378,24 @@ public class TransactionController { List resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0) .collect(Collectors.toList()); - GoalForm result = new GoalForm(); - - if (resultList.getFirst() != null) { - result = resultList.getFirst(); + + if (!resultList.isEmpty()) { + GoalForm result = resultList.getFirst(); + model.addAttribute("achievementRate", result.getAchievementRate()); - model.addAttribute("currentAmount", result.getCurrentAmount()); - model.addAttribute("targetAmount", result.getTargetAmount()); - model.addAttribute("saving", userForm.getSaving()); - model.addAttribute("deadline", result.getDeadline()); } else { model.addAttribute("achievementRate", "目標を設定してください"); - model.addAttribute("currentAmount", "目標を設定してください"); - model.addAttribute("targetAmount", "目標を設定してください"); - model.addAttribute("saving", userForm.getSaving()); - model.addAttribute("deadline", "目標を設定してください"); - } - return "menu"; } From b9bf0da507810f1c2115c7465423581358fce9a3 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Fri, 25 Sep 2026 15:22:19 +0900 Subject: [PATCH 11/18] =?UTF-8?q?[HOTFIX]=20=E7=9B=AE=E6=A8=99=E3=81=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/goal_edit.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/goal_edit.html b/src/main/resources/templates/goal_edit.html index 4915c33..876c106 100644 --- a/src/main/resources/templates/goal_edit.html +++ b/src/main/resources/templates/goal_edit.html @@ -41,13 +41,18 @@
- + +
+ +
+ + + - From d911334107027d89c12a532ad446ccb7ec86eff0 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Fri, 25 Sep 2026 15:35:12 +0900 Subject: [PATCH 12/18] =?UTF-8?q?[FIX]=20=E7=9B=AE=E6=A8=99=E5=90=8D?= =?UTF-8?q?=E3=80=81=E7=9B=AE=E6=A8=99=E8=AA=AC=E6=98=8E=E3=81=8C=E5=BF=85?= =?UTF-8?q?=E9=A0=88=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F?= =?UTF-8?q?=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=81=E7=9B=AE?= =?UTF-8?q?=E6=A8=99=E9=87=91=E9=A1=8D=E3=81=AE=E6=9C=80=E5=B0=8F=E5=80=A4?= =?UTF-8?q?=E3=82=921=E3=81=AB=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/goal_edit.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/templates/goal_edit.html b/src/main/resources/templates/goal_edit.html index 876c106..73729cc 100644 --- a/src/main/resources/templates/goal_edit.html +++ b/src/main/resources/templates/goal_edit.html @@ -24,17 +24,17 @@
- +
- +
- +
From 65bab964321f3d24438b294d1103a59e45a7d21a Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:41:06 +0900 Subject: [PATCH 13/18] =?UTF-8?q?[HOTFIX]=20=E7=9B=AE=E6=A8=99=E3=81=8C?= =?UTF-8?q?=E3=81=AA=E3=81=84=E4=BA=BA=E3=81=AF=E7=9B=AE=E6=A8=99=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=B8=E9=81=B7=E7=A7=BB=E3=81=A7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GoalController.java | 15 +++++--- src/main/resources/templates/goal_view.html | 35 ++++++++++++------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java index a29e1a1..b83f5a7 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java @@ -49,11 +49,13 @@ public class GoalController { Model model, HttpSession session, Long goalId) { - + LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); Long userId = loginUser.getUserId(); + goalService.updateGoalComplete(userId); + List goalModelList = goalService.getGoalByUserId(userId); List goalFormList1 = GoalForm.convertFrom(goalModelList); @@ -66,6 +68,10 @@ public class GoalController { "goalFormList", goalFormList); + model.addAttribute( + "achievementList", + new ArrayList()); + if (goalFormList.isEmpty()) { return "goal_view"; } @@ -188,7 +194,8 @@ public class GoalController { month = month.minusMonths(1); } - Collections.reverse(monthlySavingList); + Collections.reverse( + monthlySavingList); List achievementList = new ArrayList<>(); @@ -280,11 +287,11 @@ public class GoalController { goalService.delete(goalId); if (record == null) { - return "redirect:/goal"; + return "redirect:/goal"; } else { return "redirect:/goal/record"; } - + } @SessionCheck diff --git a/src/main/resources/templates/goal_view.html b/src/main/resources/templates/goal_view.html index a7b89ea..26ecdd4 100644 --- a/src/main/resources/templates/goal_view.html +++ b/src/main/resources/templates/goal_view.html @@ -3,6 +3,7 @@ + 目標詳細 @@ -11,14 +12,13 @@ -
+

目標詳細

-

@@ -30,30 +30,28 @@
-
+
-
+
- -
    @@ -114,6 +119,7 @@
    +
    +
    @@ -155,26 +162,29 @@
    + +
    + +
    -
@@ -186,6 +196,7 @@ +
- +
From cd4321ef8cd775c8dbc6612cd98254f0876a30ca Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 15:54:57 +0900 Subject: [PATCH 14/18] =?UTF-8?q?[EDIT]=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=97=E3=81=A6=E3=82=8B=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=81=AF=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=81=AB=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/app/presentation/controller/LoginController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java index 53cf92f..1205564 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java @@ -21,8 +21,13 @@ public class LoginController { private final LoginService loginService; @GetMapping("/login") - public String showLogin(@ModelAttribute LoginForm loginForm) { + public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) { + if (session.getAttribute("loginUser") != null) { + return "redirect:/menu"; + } + + return "login"; } @@ -32,6 +37,7 @@ public class LoginController { Model model, HttpSession session) { + LoginModel loginModel = loginService.login( loginForm.getMailAddress(), loginForm.getPassword()); From 2c445c19042b3e9e45da35ac20f390ed8ae353e0 Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 16:09:36 +0900 Subject: [PATCH 15/18] =?UTF-8?q?[FIX]=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=97=E3=81=A6=E3=82=8B=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=81=AF=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89?= =?UTF-8?q?=E5=86=8D=E8=A8=AD=E5=AE=9A=E5=BE=8C=E3=83=97=E3=83=AD=E3=83=95?= =?UTF-8?q?=E3=82=A3=E3=83=BC=E3=83=AB=E7=94=BB=E9=9D=A2=E3=81=AB=E6=88=BB?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=E3=83=BB?= =?UTF-8?q?=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89=E5=86=8D=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=AE=E9=9A=9B=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E5=8C=96=E5=87=A6=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PasswordResetServiceImpl.java | 40 ++++++++++--------- .../controller/PasswordResetController.java | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/example/demo/app/domain/service/impl/PasswordResetServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/PasswordResetServiceImpl.java index 11c7069..55cfa26 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/PasswordResetServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/PasswordResetServiceImpl.java @@ -1,5 +1,6 @@ package com.example.demo.app.domain.service.impl; +import org.mindrot.jbcrypt.BCrypt; import org.springframework.stereotype.Service; import com.example.demo.app.domain.service.PasswordResetService; @@ -13,30 +14,31 @@ import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class PasswordResetServiceImpl implements PasswordResetService { - private final UserRepository userRepository; + private final UserRepository userRepository; - @Override - public boolean resetPassword( - Long userId, - PasswordResetForm passwordResetForm) { + @Override + public boolean resetPassword( + Long userId, + PasswordResetForm passwordResetForm) { - if (!passwordResetForm.getPassword() - .equals(passwordResetForm.getPasswordConfirm())) { - return false; - } + if (!passwordResetForm.getPassword() + .equals(passwordResetForm.getPasswordConfirm())) { + return false; + } - UserEntity userEntity = - userRepository.findById(userId).orElse(null); + UserEntity userEntity = userRepository.findById(userId).orElse(null); - if (userEntity == null) { - return false; - } + if (userEntity == null) { + return false; + } - userEntity.setPassword( - passwordResetForm.getPassword()); + String passwordHashed = BCrypt.hashpw(passwordResetForm.getPassword(), BCrypt.gensalt()); - userRepository.save(userEntity); + userEntity.setPassword( + passwordHashed); - return true; - } + userRepository.save(userEntity); + + return true; + } } \ No newline at end of file diff --git a/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java b/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java index 0cba26f..a0fc051 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java @@ -62,7 +62,7 @@ public class PasswordResetController { (LoginModel) session.getAttribute("loginUser"); if (loginUser != null) { - return "redirect:/menu"; + return "redirect:/profile"; } return "redirect:/login"; From 04a6b6dedba64b9d1c69ae208de7620935e68c4e Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 16:12:00 +0900 Subject: [PATCH 16/18] =?UTF-8?q?[EDIT]=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=97=E3=81=A6=E3=81=AA=E3=81=84=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=81=AE=E3=83=98=E3=83=83=E3=83=80=E3=83=BC=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/header.html | 34 +++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/resources/templates/header.html b/src/main/resources/templates/header.html index 867f4a3..0c1ccef 100644 --- a/src/main/resources/templates/header.html +++ b/src/main/resources/templates/header.html @@ -1,30 +1,34 @@ + - -ヘッダー - - + + ヘッダー + + + - +
+ \ No newline at end of file From 6d0cad2454f05f19ff5024e03ea605a52bd6b53b Mon Sep 17 00:00:00 2001 From: kkazuya Date: Fri, 25 Sep 2026 16:44:57 +0900 Subject: [PATCH 17/18] =?UTF-8?q?[EDIT]=20=E3=83=91=E3=82=B9=E3=83=AF?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=AE=E6=96=87=E5=AD=97=E6=95=B0=E4=B8=8A?= =?UTF-8?q?=E9=99=90=E3=82=9224=E6=96=87=E5=AD=97=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/password_reset.html | 4 ++-- src/main/resources/templates/user_register.html | 2 +- src/main/resources/templates/user_register_confirm.html | 2 +- src/main/resources/templates/user_register_return.html | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/templates/password_reset.html b/src/main/resources/templates/password_reset.html index 6d350be..453a9db 100644 --- a/src/main/resources/templates/password_reset.html +++ b/src/main/resources/templates/password_reset.html @@ -38,7 +38,7 @@ class="form-control" th:field="*{password}" minlength="8" - maxlength="255" + maxlength="24" required> @@ -55,7 +55,7 @@ class="form-control" th:field="*{passwordConfirm}" minlength="8" - maxlength="255" + maxlength="24" required> diff --git a/src/main/resources/templates/user_register.html b/src/main/resources/templates/user_register.html index b8e3c0a..b8067b4 100644 --- a/src/main/resources/templates/user_register.html +++ b/src/main/resources/templates/user_register.html @@ -86,7 +86,7 @@ class="form-control" th:field="*{password}" minlength="8" - maxlength="255" + maxlength="24" required> diff --git a/src/main/resources/templates/user_register_confirm.html b/src/main/resources/templates/user_register_confirm.html index 80a4348..6d39145 100644 --- a/src/main/resources/templates/user_register_confirm.html +++ b/src/main/resources/templates/user_register_confirm.html @@ -39,7 +39,7 @@
+ maxlength="24" required readonly>
diff --git a/src/main/resources/templates/user_register_return.html b/src/main/resources/templates/user_register_return.html index 3863a24..272432d 100644 --- a/src/main/resources/templates/user_register_return.html +++ b/src/main/resources/templates/user_register_return.html @@ -54,7 +54,7 @@ class="form-control" th:value="*{password}" minlength="8" - maxlength="255" + maxlength="24" required>
From 5be30572cbc412c5dbcfccdbdf97b3096e873133 Mon Sep 17 00:00:00 2001 From: s-choi Date: Fri, 25 Sep 2026 16:49:09 +0900 Subject: [PATCH 18/18] =?UTF-8?q?[FIX]=20=E3=83=AD=E3=82=B0=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=81=AE=E9=9A=9B=E3=80=81DB=E3=81=AB=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=82=8B=E3=83=91?= =?UTF-8?q?=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89=E3=81=8C=E5=B9=B3=E6=96=87?= =?UTF-8?q?=E3=81=A0=E3=81=A3=E3=81=9F=E3=82=89=E3=83=8F=E3=83=83=E3=82=B7?= =?UTF-8?q?=E3=83=A5=E5=8C=96=E3=81=97=E3=81=A6=E5=86=8D=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=83=87=E3=83=A2?= =?UTF-8?q?=E7=94=A8=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/service/impl/LoginServiceImpl.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java index 2ec04b3..26ef947 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java @@ -27,7 +27,22 @@ public class LoginServiceImpl implements LoginService { return null; } - boolean isValidPassword = BCrypt.checkpw(password, userEntity.getPassword()); + boolean isValidPassword = false; + if (userEntity.getPassword().length() <= 24) { + if (userEntity.getPassword().equals(password)) { + + userEntity.setPassword(BCrypt.hashpw(password, BCrypt.gensalt())); + userRepository.save(userEntity); + isValidPassword = true; + + } else { + return null; + } + + } else { + + isValidPassword = BCrypt.checkpw(password, userEntity.getPassword()); + } if (!isValidPassword) { return null;