From b2c320288ecb4ec2c9274613320599177727f57f Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:38:48 +0900 Subject: [PATCH 01/16] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=B0=8F=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MemberAdminController.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index cd05991b..66c46ead 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -10,18 +10,19 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; - +import jakarta.servlet.http.HttpSession; import java.util.Arrays; import java.util.List; @Controller -@RequestMapping("/dummy") +@RequestMapping public class MemberAdminController { private final MemberRepository memberRepository; private final TokenService tokenService; private final DummyProperties dummyProperties; - + private final String adminEmail = "admin@kakao.com"; + private final String adminPassword = "1234"; private final List<String> dummyEmails = Arrays.asList( "1chulsoo@example.com", "2kim@example.com", "3lee@example.com", "4park@example.com", "5choi@example.com", "6jeong@example.com", "7han@example.com", "8oh@example.com", "9lim@example.com", "10song@example.com" @@ -33,14 +34,38 @@ public MemberAdminController(MemberRepository memberRepository, TokenService tok this.dummyProperties = dummyProperties; } - @GetMapping + @GetMapping("/dummy") public String showDummyLoginPage(Model model) { List<Member> dummyMembers = memberRepository.findAllByEmailIn(dummyEmails); model.addAttribute("members", dummyMembers); return "dummy/login"; } - @PostMapping + @GetMapping("/admin/login") + public String showAdminLoginPage(){ + return "point/login"; + } + + @PostMapping("/admin/login") + public String login(@RequestParam String email, + @RequestParam String password, + HttpSession session) { + if (adminEmail.equals(email) && adminPassword.equals(password)) { + session.setAttribute("email", email); + session.setAttribute("role", "ADMIN"); + return "redirect:/admin/point/charge"; + } else { + return "redirect:/admin/login?error=true"; + } + } + + @PostMapping("/admin/logout") + public String logout(HttpSession session) { + session.invalidate(); + return "redirect:/admin/login"; + } + + @PostMapping("/dummy") public String login( @RequestParam("email") String email, @RequestParam("password") String password, From 30d8d238acb8645692bba0f8438fac8538137d28 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:39:47 +0900 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=9C=EA=B8=88,=20=EC=B6=A9=EC=A0=84=20api=20=EB=B0=8F=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=A0=91=EA=B7=BC=20=EC=8B=9C=20?= =?UTF-8?q?=EC=84=B8=EC=85=98=EC=A0=95=EB=B3=B4=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PointAdminController.java | 53 +++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/example/sinitto/point/controller/PointAdminController.java b/src/main/java/com/example/sinitto/point/controller/PointAdminController.java index 50be1ec5..f88a662a 100644 --- a/src/main/java/com/example/sinitto/point/controller/PointAdminController.java +++ b/src/main/java/com/example/sinitto/point/controller/PointAdminController.java @@ -3,6 +3,7 @@ import com.example.sinitto.point.dto.PointLogWithBankInfo; import com.example.sinitto.point.dto.PointLogWithDepositMessage; import com.example.sinitto.point.service.PointAdminService; +import jakarta.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -21,8 +22,10 @@ public PointAdminController(PointAdminService pointAdminService) { } @GetMapping("/admin/point/charge") - public String showAllChargeRequest(Model model) { - + public String showAllChargeRequest(Model model, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } List<PointLogWithDepositMessage> logWithDepositMessages = pointAdminService.getPointLogWithDepositMessage(); model.addAttribute("logWithDepositMessages", logWithDepositMessages); @@ -31,28 +34,37 @@ public String showAllChargeRequest(Model model) { } @PostMapping("/admin/point/charge/waiting/{pointLogId}") - public String changeToWaiting(@PathVariable Long pointLogId) { - + public String changeToWaiting(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.changeChargeLogToWaiting(pointLogId); return "redirect:/admin/point/charge"; } @PostMapping("/admin/point/charge/complete/{pointLogId}") - public String changeToCompleteAndEarn(@PathVariable Long pointLogId) { - + public String changeToCompleteAndEarn(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.earnPointAndChangeToChargeComplete(pointLogId); return "redirect:/admin/point/charge"; } @PostMapping("/admin/point/charge/fail/{pointLogId}") - public String changeToFail(@PathVariable Long pointLogId) { - + public String changeToFail(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.changeChargeLogToFail(pointLogId); return "redirect:/admin/point/charge"; } @GetMapping("/admin/point/withdraw") - public String showAllWithdrawRequest(Model model) { + public String showAllWithdrawRequest(Model model, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } List<PointLogWithBankInfo> logWithBankInfos = pointAdminService.getPointLogWithBankInfo(); @@ -62,24 +74,35 @@ public String showAllWithdrawRequest(Model model) { } @PostMapping("/admin/point/withdraw/waiting/{pointLogId}") - public String changeWithdrawLogToWaiting(@PathVariable Long pointLogId) { - + public String changeWithdrawLogToWaiting(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.changeWithdrawLogToWaiting(pointLogId); return "redirect:/admin/point/withdraw"; } @PostMapping("/admin/point/withdraw/complete/{pointLogId}") - public String changeWithdrawLogToCompleteAndEarn(@PathVariable Long pointLogId) { - + public String changeWithdrawLogToCompleteAndEarn(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.changeWithdrawLogToComplete(pointLogId); return "redirect:/admin/point/withdraw"; } @PostMapping("/admin/point/withdraw/fail/{pointLogId}") - public String changeWithdrawLogToFail(@PathVariable Long pointLogId) { - + public String changeWithdrawLogToFail(@PathVariable Long pointLogId, HttpSession session) { + if(!isAdmin(session)){ + return "redirect:/admin/login"; + } pointAdminService.changeWithdrawLogToFail(pointLogId); return "redirect:/admin/point/withdraw"; } + private boolean isAdmin(HttpSession session) { + String role = (String) session.getAttribute("role"); + return "ADMIN".equals(role); + } + } From 5fe440560fa749dd994486a99fdfa44cf6f334ff Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:40:03 +0900 Subject: [PATCH 03/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/point/login.html | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main/resources/templates/point/login.html diff --git a/src/main/resources/templates/point/login.html b/src/main/resources/templates/point/login.html new file mode 100644 index 00000000..56ef3aef --- /dev/null +++ b/src/main/resources/templates/point/login.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <link href="/css/login.css" rel="stylesheet"> + <title>Admin Login</title> +</head> +<body> +<h1>Admin Login</h1> + +<form id="loginForm" action="/admin/login" method="POST"> + <div> + <label for="email">Email:</label> + <input type="email" id="email" name="email" required> + </div> + <div> + <label for="password">Password:</label> + <input type="password" id="password" name="password" required> + </div> + <button type="submit">Login</button> +</form> + +<div id="errorMessage" style="color:orange;"></div> + +<script> + // 페이지가 로드되었을 때, 쿼리 파라미터에 'error'가 있으면 오류 메시지 표시 + window.onload = function() { + const urlParams = new URLSearchParams(window.location.search); + if (urlParams.has('error')) { + document.getElementById("errorMessage").textContent = '로그인 정보를 다시 확인해주세요'; + } + }; +</script> +</body> +</html> From a8526bc95501bc78958f8163101f591f63c188d6 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:40:46 +0900 Subject: [PATCH 04/16] =?UTF-8?q?feat:=20=ED=97=A4=EB=8D=94=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20(=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EB=B0=8F?= =?UTF-8?q?=20=EC=B6=A9=EC=A0=84,=20=EC=B6=9C=EA=B8=88=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=83=81=ED=98=B8=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/point/header.html | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/main/resources/templates/point/header.html diff --git a/src/main/resources/templates/point/header.html b/src/main/resources/templates/point/header.html new file mode 100644 index 00000000..51cd2ba9 --- /dev/null +++ b/src/main/resources/templates/point/header.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"> +<head> + <meta charset="UTF-8"> + <link href="/css/header.css" rel="stylesheet"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Admin Header</title> +</head> +<body> +<div th:fragment="header"> + <div class="header"> + <h1>Admin Dashboard</h1> + <nav> + <button onclick="window.location.href='/admin/point/charge'">충전 관리</button> + <button onclick="window.location.href='/admin/point/withdraw'">출금 관리</button> + <form action="/admin/logout" method="POST"> + <button type="submit">Logout</button> + </form> + </nav> + </div> +</div> +</body> +</html> From ec74fdd122c80d701d30d5e055ded8c4e19e88f9 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:41:14 +0900 Subject: [PATCH 05/16] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20css=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/css/login.css | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/resources/static/css/login.css diff --git a/src/main/resources/static/css/login.css b/src/main/resources/static/css/login.css new file mode 100644 index 00000000..72f9e26e --- /dev/null +++ b/src/main/resources/static/css/login.css @@ -0,0 +1,73 @@ +/* 기본 스타일 설정 */ +body { + font-family: Arial, sans-serif; + background-color: #f4f7fb; /* 연한 배경색 */ + margin: 0; + padding: 0; + color: #333; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; /* 화면 전체 높이 */ + flex-direction: column; +} + +/* 제목 스타일 */ +h1 { + font-size: 32px; + color: #344fd9; /* 파란색 제목 */ + margin-bottom: 40px; + text-align: center; +} + +/* 로그인 폼 스타일 */ +form { + background-color: #ffffff; + padding: 40px; + border-radius: 8px; + box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); + width: 100%; + max-width: 400px; /* 폼 너비 제한 */ +} + +/* 폼 내부 레이블 스타일 */ +form div { + margin-bottom: 20px; +} + +/* 레이블 스타일 */ +label { + display: block; + margin-bottom: 5px; + font-weight: 600; + color: #555; +} + +/* 입력 필드 스타일 */ +input[type="email"], input[type="password"] { + width: 100%; + padding: 12px; + font-size: 16px; + border: 1px solid #ddd; + border-radius: 4px; + box-sizing: border-box; + transition: border-color 0.3s; +} + +/* 입력 필드 포커스 시 스타일 */ +input[type="email"]:focus, input[type="password"]:focus { + border-color: #344fd9; /* 포커스 시 파란색 테두리 */ + outline: none; +} + +/* 로그인 버튼 스타일 */ +button { + width: 100%; + padding: 12px; + font-size: 16px; + background-color: #344fd9; /* 파란색 배경 */ + color: #ffffff; + border: none; + border-radius: 4px; + cursor: pointer; + From 4a4d1ca4cdd959143419fde58e1a0dc964d932ad Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:41:31 +0900 Subject: [PATCH 06/16] =?UTF-8?q?feat:=20=ED=97=A4=EB=8D=94(=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8)=20css=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/css/header.css | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main/resources/static/css/header.css diff --git a/src/main/resources/static/css/header.css b/src/main/resources/static/css/header.css new file mode 100644 index 00000000..e7da7b67 --- /dev/null +++ b/src/main/resources/static/css/header.css @@ -0,0 +1,54 @@ + +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 20px; + color: #333; +} + +.header { + background-color: transparent; + border: none; + padding: 20px; + color: #333; + margin-bottom: 30px; + display: flex; + justify-content: space-between; + align-items: center; + +.header h1 { + margin: 0; + font-size: 24px; + font-weight: 600; +} + + +nav { + display: flex; + gap: 15px; + justify-content: flex-end; +} + +button { + background-color: rgba(52, 87, 217, 0.8); + color: #ffffff; + border: none; + padding: 10px 20px; + font-size: 14px; + cursor: pointer; + border-radius: 4px; + transition: background-color 0.3s, transform 0.2s; +} + +button:hover { + background-color: rgba(52, 87, 217, 0.93); + transform: scale(1.03); +} + +button:active { + background-color: #00473c; +} + +form { + display: inline; +} From a3f106765630f525ca538e2cf1166086817f11ee Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:42:11 +0900 Subject: [PATCH 07/16] =?UTF-8?q?feat:=20=ED=97=A4=EB=8D=94=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20(=EC=B6=A9=EC=A0=84,=20=EC=B6=9C=EA=B8=88=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=83=81=ED=98=B8=20=EC=9D=B4?= =?UTF-8?q?=EB=8F=99=20=EB=B0=8F=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/point/charge.html | 4 ++-- src/main/resources/templates/point/withdraw.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/point/charge.html b/src/main/resources/templates/point/charge.html index 61414c1c..d4edcb17 100644 --- a/src/main/resources/templates/point/charge.html +++ b/src/main/resources/templates/point/charge.html @@ -1,12 +1,12 @@ <!DOCTYPE html> -<html lang="kr"> +<html lang="kr" xmlns:th="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"> <link href="/css/point.css" rel="stylesheet"> <title>충전 페이지</title> </head> <body> - +<div th:replace="~{point/header}"></div> <div> <h1>포인트 충전 관리</h1> </div> diff --git a/src/main/resources/templates/point/withdraw.html b/src/main/resources/templates/point/withdraw.html index 14ea5bd5..5c4e86fb 100644 --- a/src/main/resources/templates/point/withdraw.html +++ b/src/main/resources/templates/point/withdraw.html @@ -1,12 +1,12 @@ <!DOCTYPE html> -<html lang="kr"> +<html lang="kr" xmlns:th="http://www.w3.org/1999/xhtml"> <head> <meta charset="UTF-8"> <link href="/css/point.css" rel="stylesheet"> <title>출금 페이지</title> </head> <body> - +<div th:replace="~{point/header}"></div> <div> <h1>포인트 출금 관리</h1> </div> From e5e8f5ce3bc58fa3252ab5c0829f9d83d95e8f47 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:43:42 +0900 Subject: [PATCH 08/16] feat: Reformat Code --- .../member/controller/MemberAdminController.java | 5 +++-- .../point/controller/PointAdminController.java | 16 ++++++++-------- src/main/resources/templates/point/header.html | 2 +- src/main/resources/templates/point/login.html | 6 +++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index 66c46ead..8b18fa8c 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -4,13 +4,14 @@ import com.example.sinitto.common.properties.DummyProperties; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; +import jakarta.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import jakarta.servlet.http.HttpSession; + import java.util.Arrays; import java.util.List; @@ -42,7 +43,7 @@ public String showDummyLoginPage(Model model) { } @GetMapping("/admin/login") - public String showAdminLoginPage(){ + public String showAdminLoginPage() { return "point/login"; } diff --git a/src/main/java/com/example/sinitto/point/controller/PointAdminController.java b/src/main/java/com/example/sinitto/point/controller/PointAdminController.java index f88a662a..07ad9b89 100644 --- a/src/main/java/com/example/sinitto/point/controller/PointAdminController.java +++ b/src/main/java/com/example/sinitto/point/controller/PointAdminController.java @@ -23,7 +23,7 @@ public PointAdminController(PointAdminService pointAdminService) { @GetMapping("/admin/point/charge") public String showAllChargeRequest(Model model, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } List<PointLogWithDepositMessage> logWithDepositMessages = pointAdminService.getPointLogWithDepositMessage(); @@ -35,7 +35,7 @@ public String showAllChargeRequest(Model model, HttpSession session) { @PostMapping("/admin/point/charge/waiting/{pointLogId}") public String changeToWaiting(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.changeChargeLogToWaiting(pointLogId); @@ -44,7 +44,7 @@ public String changeToWaiting(@PathVariable Long pointLogId, HttpSession session @PostMapping("/admin/point/charge/complete/{pointLogId}") public String changeToCompleteAndEarn(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.earnPointAndChangeToChargeComplete(pointLogId); @@ -53,7 +53,7 @@ public String changeToCompleteAndEarn(@PathVariable Long pointLogId, HttpSession @PostMapping("/admin/point/charge/fail/{pointLogId}") public String changeToFail(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.changeChargeLogToFail(pointLogId); @@ -62,7 +62,7 @@ public String changeToFail(@PathVariable Long pointLogId, HttpSession session) { @GetMapping("/admin/point/withdraw") public String showAllWithdrawRequest(Model model, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } @@ -75,7 +75,7 @@ public String showAllWithdrawRequest(Model model, HttpSession session) { @PostMapping("/admin/point/withdraw/waiting/{pointLogId}") public String changeWithdrawLogToWaiting(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.changeWithdrawLogToWaiting(pointLogId); @@ -84,7 +84,7 @@ public String changeWithdrawLogToWaiting(@PathVariable Long pointLogId, HttpSess @PostMapping("/admin/point/withdraw/complete/{pointLogId}") public String changeWithdrawLogToCompleteAndEarn(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.changeWithdrawLogToComplete(pointLogId); @@ -93,7 +93,7 @@ public String changeWithdrawLogToCompleteAndEarn(@PathVariable Long pointLogId, @PostMapping("/admin/point/withdraw/fail/{pointLogId}") public String changeWithdrawLogToFail(@PathVariable Long pointLogId, HttpSession session) { - if(!isAdmin(session)){ + if (!isAdmin(session)) { return "redirect:/admin/login"; } pointAdminService.changeWithdrawLogToFail(pointLogId); diff --git a/src/main/resources/templates/point/header.html b/src/main/resources/templates/point/header.html index 51cd2ba9..227f9a43 100644 --- a/src/main/resources/templates/point/header.html +++ b/src/main/resources/templates/point/header.html @@ -3,7 +3,7 @@ <head> <meta charset="UTF-8"> <link href="/css/header.css" rel="stylesheet"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta content="width=device-width, initial-scale=1.0" name="viewport"> <title>Admin Header</title> </head> <body> diff --git a/src/main/resources/templates/point/login.html b/src/main/resources/templates/point/login.html index 56ef3aef..895b479e 100644 --- a/src/main/resources/templates/point/login.html +++ b/src/main/resources/templates/point/login.html @@ -8,14 +8,14 @@ <body> <h1>Admin Login</h1> -<form id="loginForm" action="/admin/login" method="POST"> +<form action="/admin/login" id="loginForm" method="POST"> <div> <label for="email">Email:</label> - <input type="email" id="email" name="email" required> + <input id="email" name="email" required type="email"> </div> <div> <label for="password">Password:</label> - <input type="password" id="password" name="password" required> + <input id="password" name="password" required type="password"> </div> <button type="submit">Login</button> </form> From 53827b25de670a3d920db1b4289e75393e6a4904 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 06:53:01 +0900 Subject: [PATCH 09/16] =?UTF-8?q?feat:=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/static/css/login.css | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/main/resources/static/css/login.css b/src/main/resources/static/css/login.css index 72f9e26e..9e004565 100644 --- a/src/main/resources/static/css/login.css +++ b/src/main/resources/static/css/login.css @@ -8,34 +8,32 @@ body { display: flex; justify-content: center; align-items: center; - height: 100vh; /* 화면 전체 높이 */ + height: 100vh; flex-direction: column; } -/* 제목 스타일 */ h1 { font-size: 32px; - color: #344fd9; /* 파란색 제목 */ + color: #344fd9; margin-bottom: 40px; text-align: center; } -/* 로그인 폼 스타일 */ form { background-color: #ffffff; padding: 40px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); width: 100%; - max-width: 400px; /* 폼 너비 제한 */ + max-width: 400px; } -/* 폼 내부 레이블 스타일 */ + form div { margin-bottom: 20px; } -/* 레이블 스타일 */ + label { display: block; margin-bottom: 5px; @@ -43,7 +41,7 @@ label { color: #555; } -/* 입력 필드 스타일 */ + input[type="email"], input[type="password"] { width: 100%; padding: 12px; @@ -54,20 +52,20 @@ input[type="email"], input[type="password"] { transition: border-color 0.3s; } -/* 입력 필드 포커스 시 스타일 */ + input[type="email"]:focus, input[type="password"]:focus { - border-color: #344fd9; /* 포커스 시 파란색 테두리 */ + border-color: #344fd9; outline: none; } -/* 로그인 버튼 스타일 */ + button { width: 100%; padding: 12px; font-size: 16px; - background-color: #344fd9; /* 파란색 배경 */ + background-color: #344fd9; color: #ffffff; border: none; border-radius: 4px; cursor: pointer; - +} From 73b5fccc1f5975aa6c77b05d8a78cecdeb87dc56 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 17:30:07 +0900 Subject: [PATCH 10/16] =?UTF-8?q?refactor:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=20=EC=83=81=ED=83=9C=EC=97=90=EC=84=9C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=9D=B4=EB=8F=99?= =?UTF-8?q?=EC=8B=9C=20=EC=B6=A9=EC=A0=84=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=A1=9C=20=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sinitto/member/controller/MemberAdminController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index 8b18fa8c..fb18a1ff 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -43,7 +43,8 @@ public String showDummyLoginPage(Model model) { } @GetMapping("/admin/login") - public String showAdminLoginPage() { + public String showAdminLoginPage(HttpSession session) { + if (isAdmin(session)) { return "redirect:/admin/point/charge"; } return "point/login"; } @@ -93,4 +94,9 @@ public String login( String frontendRedirectUrl = env.equals("dev") ? dummyProperties.devRedirectUri() : dummyProperties.redirectUri(); return "redirect:" + frontendRedirectUrl + "?accessToken=" + accessToken + "&refreshToken=" + refreshToken + "&isSinitto=" + isSinitto; } + + private boolean isAdmin(HttpSession session) { + String role = (String) session.getAttribute("role"); + return "ADMIN".equals(role); + } } From 0262f496dc6ff5f6afdaa9728d29f948dbaf0bd9 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 17:38:39 +0900 Subject: [PATCH 11/16] =?UTF-8?q?refactor:=20session=20timeout=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/sinitto/member/controller/MemberAdminController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index fb18a1ff..27059416 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -55,6 +55,7 @@ public String login(@RequestParam String email, if (adminEmail.equals(email) && adminPassword.equals(password)) { session.setAttribute("email", email); session.setAttribute("role", "ADMIN"); + session.setMaxInactiveInterval(1800); return "redirect:/admin/point/charge"; } else { return "redirect:/admin/login?error=true"; From 8086e625a57e589cd5c9eeaf85224f1c981039c6 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 17:57:35 +0900 Subject: [PATCH 12/16] =?UTF-8?q?feat:=20AdminProperties=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sinitto/common/properties/AdminProperties.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/main/java/com/example/sinitto/common/properties/AdminProperties.java diff --git a/src/main/java/com/example/sinitto/common/properties/AdminProperties.java b/src/main/java/com/example/sinitto/common/properties/AdminProperties.java new file mode 100644 index 00000000..a7d6ee35 --- /dev/null +++ b/src/main/java/com/example/sinitto/common/properties/AdminProperties.java @@ -0,0 +1,10 @@ +package com.example.sinitto.common.properties; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "admin") +public record AdminProperties( + String adminEmail, + String adminPassword +) { +} \ No newline at end of file From 9be6f84d852410fc88e4a43c1151a4d1ab6009ad Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 17:58:48 +0900 Subject: [PATCH 13/16] =?UTF-8?q?refactor:=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=20=EA=B3=84=EC=A0=95=20=EC=A0=95=EB=B3=B4=20=EC=88=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sinitto/member/controller/MemberAdminController.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index 27059416..06656786 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -1,6 +1,7 @@ package com.example.sinitto.member.controller; import com.example.sinitto.auth.service.TokenService; +import com.example.sinitto.common.properties.AdminProperties; import com.example.sinitto.common.properties.DummyProperties; import com.example.sinitto.member.entity.Member; import com.example.sinitto.member.repository.MemberRepository; @@ -22,17 +23,17 @@ public class MemberAdminController { private final MemberRepository memberRepository; private final TokenService tokenService; private final DummyProperties dummyProperties; - private final String adminEmail = "admin@kakao.com"; - private final String adminPassword = "1234"; + private final AdminProperties adminProperties; private final List<String> dummyEmails = Arrays.asList( "1chulsoo@example.com", "2kim@example.com", "3lee@example.com", "4park@example.com", "5choi@example.com", "6jeong@example.com", "7han@example.com", "8oh@example.com", "9lim@example.com", "10song@example.com" ); - public MemberAdminController(MemberRepository memberRepository, TokenService tokenService, DummyProperties dummyProperties) { + public MemberAdminController(MemberRepository memberRepository, TokenService tokenService, DummyProperties dummyProperties, AdminProperties adminProperties) { this.memberRepository = memberRepository; this.tokenService = tokenService; this.dummyProperties = dummyProperties; + this.adminProperties = adminProperties; } @GetMapping("/dummy") @@ -52,7 +53,7 @@ public String showAdminLoginPage(HttpSession session) { public String login(@RequestParam String email, @RequestParam String password, HttpSession session) { - if (adminEmail.equals(email) && adminPassword.equals(password)) { + if (adminProperties.adminEmail().equals(email) && adminProperties.adminPassword().equals(password)) { session.setAttribute("email", email); session.setAttribute("role", "ADMIN"); session.setMaxInactiveInterval(1800); From 9498cf0796646a2a92a493ebf7473fb73aadfbd1 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 17:59:39 +0900 Subject: [PATCH 14/16] =?UTF-8?q?refactor:=20@EnableConfigurationPropertie?= =?UTF-8?q?s=EC=97=90=20properties=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/example/sinitto/SinittoApplication.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/example/sinitto/SinittoApplication.java b/src/main/java/com/example/sinitto/SinittoApplication.java index 7aef98e4..a8243d84 100644 --- a/src/main/java/com/example/sinitto/SinittoApplication.java +++ b/src/main/java/com/example/sinitto/SinittoApplication.java @@ -1,5 +1,6 @@ package com.example.sinitto; +import com.example.sinitto.common.properties.AdminProperties; import com.example.sinitto.common.properties.DummyProperties; import com.example.sinitto.common.properties.KakaoProperties; import org.springframework.boot.SpringApplication; @@ -10,7 +11,7 @@ @SpringBootApplication @EnableJpaAuditing -@EnableConfigurationProperties({KakaoProperties.class, DummyProperties.class}) +@EnableConfigurationProperties({KakaoProperties.class, DummyProperties.class, AdminProperties.class}) @EnableScheduling public class SinittoApplication { From 612248fab24ac0d2a1f9fa3f421ed3d4edcd15bd Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 18:02:02 +0900 Subject: [PATCH 15/16] refactor: Reformat Code --- .../sinitto/auth/controller/AuthController.java | 2 +- .../sinitto/auth/service/TokenService.java | 2 +- .../sinitto/common/config/SwaggerConfig.java | 5 ++--- .../example/sinitto/common/config/WebConfig.java | 2 +- .../common/interceptor/JwtInterceptor.java | 5 +++-- .../common/service/SlackMessageService.java | 5 +---- .../sinitto/guard/service/GuardService.java | 4 ++-- .../member/controller/MemberAdminController.java | 4 +++- .../member/service/MemberTokenService.java | 2 +- .../example/sinitto/review/entity/Review.java | 12 +++--------- src/main/resources/templates/dummy/login.html | 16 ++++++++-------- .../sinitto/auth/service/TokenServiceTest.java | 2 +- 12 files changed, 27 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/example/sinitto/auth/controller/AuthController.java b/src/main/java/com/example/sinitto/auth/controller/AuthController.java index fb11918d..ba9750c6 100644 --- a/src/main/java/com/example/sinitto/auth/controller/AuthController.java +++ b/src/main/java/com/example/sinitto/auth/controller/AuthController.java @@ -58,7 +58,7 @@ public ResponseEntity<LoginResponse> kakaoCallback(@RequestParam("code") String @Operation(summary = "Redis안의 모든 데이터 제거", description = "발급된 refreshToken을 사용하지 못하게 Redis 안의 모든 데이터를 제거합니다.") @DeleteMapping("/redis") - public ResponseEntity<Void> deleteAllDataFromRedis(){ + public ResponseEntity<Void> deleteAllDataFromRedis() { tokenService.deleteAllDataFromRedis(); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/src/main/java/com/example/sinitto/auth/service/TokenService.java b/src/main/java/com/example/sinitto/auth/service/TokenService.java index fa972d3d..713708ee 100644 --- a/src/main/java/com/example/sinitto/auth/service/TokenService.java +++ b/src/main/java/com/example/sinitto/auth/service/TokenService.java @@ -120,7 +120,7 @@ public TokenResponse refreshAccessToken(String refreshToken) { return new TokenResponse(newAccessToken, newRefreshToken); } - public void deleteAllDataFromRedis(){ + public void deleteAllDataFromRedis() { redisTemplate.getConnectionFactory() .getConnection() .serverCommands() diff --git a/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java b/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java index 9e7a9e76..6e8001c5 100644 --- a/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java +++ b/src/main/java/com/example/sinitto/common/config/SwaggerConfig.java @@ -3,9 +3,9 @@ import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; @@ -14,10 +14,9 @@ @Configuration public class SwaggerConfig { - private final Environment environment; - private static final String LOCAL_SERVER_URL = "http://localhost:8080"; private static final String PROD_SERVER_URL = "https://sinitto.site"; + private final Environment environment; public SwaggerConfig(Environment environment) { this.environment = environment; diff --git a/src/main/java/com/example/sinitto/common/config/WebConfig.java b/src/main/java/com/example/sinitto/common/config/WebConfig.java index ae986fd1..75558393 100644 --- a/src/main/java/com/example/sinitto/common/config/WebConfig.java +++ b/src/main/java/com/example/sinitto/common/config/WebConfig.java @@ -27,7 +27,7 @@ public class WebConfig implements WebMvcConfigurer { private static final int CONNECTIONS_PER_IP_PORT_PAIR = 5; private final JwtInterceptor jwtInterceptor; - public WebConfig(JwtInterceptor jwtInterceptor){ + public WebConfig(JwtInterceptor jwtInterceptor) { this.jwtInterceptor = jwtInterceptor; } diff --git a/src/main/java/com/example/sinitto/common/interceptor/JwtInterceptor.java b/src/main/java/com/example/sinitto/common/interceptor/JwtInterceptor.java index 10b9b13c..9e5ea039 100644 --- a/src/main/java/com/example/sinitto/common/interceptor/JwtInterceptor.java +++ b/src/main/java/com/example/sinitto/common/interceptor/JwtInterceptor.java @@ -14,11 +14,12 @@ public class JwtInterceptor implements HandlerInterceptor { private final MemberTokenService memberTokenService; - public JwtInterceptor(MemberTokenService memberTokenService){ + public JwtInterceptor(MemberTokenService memberTokenService) { this.memberTokenService = memberTokenService; } + @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){ + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { if (handler instanceof HandlerMethod) { HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); diff --git a/src/main/java/com/example/sinitto/common/service/SlackMessageService.java b/src/main/java/com/example/sinitto/common/service/SlackMessageService.java index 772040ed..59df7d10 100644 --- a/src/main/java/com/example/sinitto/common/service/SlackMessageService.java +++ b/src/main/java/com/example/sinitto/common/service/SlackMessageService.java @@ -14,17 +14,14 @@ @Service public class SlackMessageService { + private final RestTemplate restTemplate; @Value("${slack.notice.webhook.url}") private String slackNoticeWebhookUrl; - @Value("${slack.charge.request.url}") private String chargeRequestUrl; - @Value("${slack.withdraw.request.url}") private String withdrawRequestUrl; - private final RestTemplate restTemplate; - public SlackMessageService(RestTemplate restTemplate) { this.restTemplate = restTemplate; } diff --git a/src/main/java/com/example/sinitto/guard/service/GuardService.java b/src/main/java/com/example/sinitto/guard/service/GuardService.java index b08fab92..3d715644 100644 --- a/src/main/java/com/example/sinitto/guard/service/GuardService.java +++ b/src/main/java/com/example/sinitto/guard/service/GuardService.java @@ -59,7 +59,7 @@ public void createSenior(Long memberId, SeniorRequest seniorRequest) { ); if (member.isSinitto()) throw new BadRequestException("보호자만 이용할 수 있습니다."); - if(seniorRepository.existsByPhoneNumber(seniorRequest.seniorPhoneNumber())) { + if (seniorRepository.existsByPhoneNumber(seniorRequest.seniorPhoneNumber())) { throw new BadRequestException("이미 등록되어 있는 전화번호 입니다."); } @@ -90,7 +90,7 @@ public void updateSenior(Long memberId, Long seniorId, SeniorRequest seniorReque () -> new NotFoundException("이메일에 해당하는 시니어를 찾을 수 없습니다.") ); - if(!senior.getPhoneNumber().equals(seniorRequest.seniorPhoneNumber()) + if (!senior.getPhoneNumber().equals(seniorRequest.seniorPhoneNumber()) && seniorRepository.existsByPhoneNumber(seniorRequest.seniorPhoneNumber())) { throw new BadRequestException("이미 등록되어 있는 전화번호 입니다."); } diff --git a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java index 06656786..fd1bd10f 100644 --- a/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java +++ b/src/main/java/com/example/sinitto/member/controller/MemberAdminController.java @@ -45,7 +45,9 @@ public String showDummyLoginPage(Model model) { @GetMapping("/admin/login") public String showAdminLoginPage(HttpSession session) { - if (isAdmin(session)) { return "redirect:/admin/point/charge"; } + if (isAdmin(session)) { + return "redirect:/admin/point/charge"; + } return "point/login"; } diff --git a/src/main/java/com/example/sinitto/member/service/MemberTokenService.java b/src/main/java/com/example/sinitto/member/service/MemberTokenService.java index fd18ef08..ad029861 100644 --- a/src/main/java/com/example/sinitto/member/service/MemberTokenService.java +++ b/src/main/java/com/example/sinitto/member/service/MemberTokenService.java @@ -11,7 +11,7 @@ public class MemberTokenService { private final TokenService tokenService; private final MemberRepository memberRepository; - public MemberTokenService(TokenService tokenService, MemberRepository memberRepository){ + public MemberTokenService(TokenService tokenService, MemberRepository memberRepository) { this.tokenService = tokenService; this.memberRepository = memberRepository; } diff --git a/src/main/java/com/example/sinitto/review/entity/Review.java b/src/main/java/com/example/sinitto/review/entity/Review.java index 1c1f69fb..244e42f4 100644 --- a/src/main/java/com/example/sinitto/review/entity/Review.java +++ b/src/main/java/com/example/sinitto/review/entity/Review.java @@ -14,24 +14,18 @@ @Entity @EntityListeners(AuditingEntityListener.class) public class Review { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - @NotNull int starCountForRequest; - @NotNull int starCountForService; - @NotNull int starCountForSatisfaction; - @CreatedDate LocalDate postDate; - String content; - + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") @NotNull diff --git a/src/main/resources/templates/dummy/login.html b/src/main/resources/templates/dummy/login.html index 99921f8d..29aaa17e 100644 --- a/src/main/resources/templates/dummy/login.html +++ b/src/main/resources/templates/dummy/login.html @@ -9,24 +9,24 @@ <h2>더미데이터 유저 로그인</h2> <p style="color: black; font-weight: bold;"> 해당 페이지는 개발자용 페이지입니다. 더미데이터 유저만 로그인이 가능합니다. </p> -<p th:if="${errorMessage}" th:text="${errorMessage}" style="color: red;"></p> +<p style="color: red;" th:if="${errorMessage}" th:text="${errorMessage}"></p> -<form th:action="@{/dummy}" method="post"> +<form method="post" th:action="@{/dummy}"> <label for="email">이메일:</label> <select id="email" name="email" required> - <option value="" disabled selected>이메일을 선택하세요</option> - <option th:each="member, iterStat : ${members}" th:value="${member.email}" - th:text="${member.email + ' (' + (member.isSinitto ? '시니또' : '보호자') + ' ' + (iterStat.index + 1) + ')'}"> + <option disabled selected value="">이메일을 선택하세요</option> + <option th:each="member, iterStat : ${members}" th:text="${member.email + ' (' + (member.isSinitto ? '시니또' : '보호자') + ' ' + (iterStat.index + 1) + ')'}" + th:value="${member.email}"> </option> </select> <br><br> <label for="password">비밀번호:</label> - <input type="password" id="password" name="password" required/><br><br> + <input id="password" name="password" required type="password"/><br><br> <div class="button-container"> - <button type="submit" name="env" value="dev">개발 환경으로 로그인</button> - <button type="submit" name="env" value="prod">배포 서버로 로그인</button> + <button name="env" type="submit" value="dev">개발 환경으로 로그인</button> + <button name="env" type="submit" value="prod">배포 서버로 로그인</button> </div> </form> </body> diff --git a/src/test/java/com/example/sinitto/auth/service/TokenServiceTest.java b/src/test/java/com/example/sinitto/auth/service/TokenServiceTest.java index d14be2ff..87e087be 100644 --- a/src/test/java/com/example/sinitto/auth/service/TokenServiceTest.java +++ b/src/test/java/com/example/sinitto/auth/service/TokenServiceTest.java @@ -80,7 +80,7 @@ void generateRefreshTokenTest() { @Test @DisplayName("deleteAllDataFromRedis 메소드 테스트") - void deleteAllDataFromRedisTest(){ + void deleteAllDataFromRedisTest() { //given String email = "test@email.com"; String refreshToken = "test.Refresh.Token"; From 8208462050b71ffbbef94a33b4d3a099ba7ea566 Mon Sep 17 00:00:00 2001 From: eunsoni <esk12704@gmail.com> Date: Mon, 11 Nov 2024 18:08:56 +0900 Subject: [PATCH 16/16] =?UTF-8?q?refactor:=20url=EC=97=90=EC=84=9C=20sessi?= =?UTF-8?q?onid=20=EC=88=A8=EA=B9=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f0993146..f89fd298 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,3 +7,4 @@ spring.profiles.active=dev spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect spring.h2.console.enabled=false +server.servlet.session.tracking-modes = cookie