From c277eb1a27bc279cd9c99779b136d2fd90b5f544 Mon Sep 17 00:00:00 2001 From: nevermoregb Date: Thu, 13 Mar 2025 10:37:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../company/localhost/controller/api/BoardController.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/company/localhost/controller/api/BoardController.java b/src/main/java/io/company/localhost/controller/api/BoardController.java index b122932..e9a8eb7 100644 --- a/src/main/java/io/company/localhost/controller/api/BoardController.java +++ b/src/main/java/io/company/localhost/controller/api/BoardController.java @@ -49,6 +49,7 @@ import io.company.localhost.common.dto.ApiResponse; import io.company.localhost.common.dto.MapDto; import io.company.localhost.common.exception.InvalidPasswordException; import io.company.localhost.common.exception.NotFoundHandler; +import io.company.localhost.common.exception.code.UserErrorCode; import io.company.localhost.service.commoncodService; import io.company.localhost.service.localbordService; import io.company.localhost.utils.AuthUtil; @@ -329,11 +330,13 @@ public class BoardController { String storedHashedPassword = boardService.selectBoardPassword(boardId); if (storedHashedPassword == null) { throw new NotFoundHandler("해당 게시물이 존재하지 않습니다."); + } boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword); if (!isMatch) { - throw new InvalidPasswordException("비밀번호가 일치하지 않습니다."); + //throw new InvalidPasswordException("비밀번호가 일치하지 않습니다."); + return ApiResponse.error(HttpStatus.UNAUTHORIZED, "비밀번호가 일치하지 않습니다."); } return ApiResponse.ok(true); @@ -366,7 +369,8 @@ public class BoardController { boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword); if (!isMatch) { - throw new InvalidPasswordException("비밀번호가 일치하지 않습니다."); + //throw new InvalidPasswordException("비밀번호가 일치하지 않습니다."); + return ApiResponse.error(HttpStatus.UNAUTHORIZED, "비밀번호가 일치하지 않습니다."); } return ApiResponse.ok(true);