응답 처리 변경
This commit is contained in:
parent
f52b5be47c
commit
c277eb1a27
@ -49,6 +49,7 @@ import io.company.localhost.common.dto.ApiResponse;
|
|||||||
import io.company.localhost.common.dto.MapDto;
|
import io.company.localhost.common.dto.MapDto;
|
||||||
import io.company.localhost.common.exception.InvalidPasswordException;
|
import io.company.localhost.common.exception.InvalidPasswordException;
|
||||||
import io.company.localhost.common.exception.NotFoundHandler;
|
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.commoncodService;
|
||||||
import io.company.localhost.service.localbordService;
|
import io.company.localhost.service.localbordService;
|
||||||
import io.company.localhost.utils.AuthUtil;
|
import io.company.localhost.utils.AuthUtil;
|
||||||
@ -329,11 +330,13 @@ public class BoardController {
|
|||||||
String storedHashedPassword = boardService.selectBoardPassword(boardId);
|
String storedHashedPassword = boardService.selectBoardPassword(boardId);
|
||||||
if (storedHashedPassword == null) {
|
if (storedHashedPassword == null) {
|
||||||
throw new NotFoundHandler("해당 게시물이 존재하지 않습니다.");
|
throw new NotFoundHandler("해당 게시물이 존재하지 않습니다.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword);
|
boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword);
|
||||||
if (!isMatch) {
|
if (!isMatch) {
|
||||||
throw new InvalidPasswordException("비밀번호가 일치하지 않습니다.");
|
//throw new InvalidPasswordException("비밀번호가 일치하지 않습니다.");
|
||||||
|
return ApiResponse.error(HttpStatus.UNAUTHORIZED, "비밀번호가 일치하지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiResponse.ok(true);
|
return ApiResponse.ok(true);
|
||||||
@ -366,7 +369,8 @@ public class BoardController {
|
|||||||
|
|
||||||
boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword);
|
boolean isMatch = passwordEncoder.matches(rawPassword, storedHashedPassword);
|
||||||
if (!isMatch) {
|
if (!isMatch) {
|
||||||
throw new InvalidPasswordException("비밀번호가 일치하지 않습니다.");
|
//throw new InvalidPasswordException("비밀번호가 일치하지 않습니다.");
|
||||||
|
return ApiResponse.error(HttpStatus.UNAUTHORIZED, "비밀번호가 일치하지 않습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiResponse.ok(true);
|
return ApiResponse.ok(true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user