From 9b9c916a9c5d12ad427c7a60cb710b083af252c4 Mon Sep 17 00:00:00 2001 From: LinaKK Date: Wed, 13 Mar 2024 01:40:22 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=ED=99=95=EC=9D=B8,=20=EC=9D=B4=EB=A6=84=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=ED=99=95=EC=9D=B8=20=EB=AF=B8=EB=8F=99=EC=9E=91=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageTrip/member/controller/MemberController.java | 2 +- .../java/com/ImageTrip/member/service/MemberService.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ImageTrip/member/controller/MemberController.java b/src/main/java/com/ImageTrip/member/controller/MemberController.java index 9d2b2a6..9b36501 100644 --- a/src/main/java/com/ImageTrip/member/controller/MemberController.java +++ b/src/main/java/com/ImageTrip/member/controller/MemberController.java @@ -34,7 +34,7 @@ public MemberController(MemberService memberService, @PostMapping("/checkUsableEmail") public ResponseEntity checkUseableEmail(@RequestBody @Valid MemberDto.CheckEmailDto checkEmailDto){ - memberService.verifyExistsName(checkEmailDto.getEmail()); + memberService.verifyExistsEmail(checkEmailDto.getEmail()); return new ResponseEntity<>(HttpStatus.OK); } diff --git a/src/main/java/com/ImageTrip/member/service/MemberService.java b/src/main/java/com/ImageTrip/member/service/MemberService.java index 99bda98..2207a99 100644 --- a/src/main/java/com/ImageTrip/member/service/MemberService.java +++ b/src/main/java/com/ImageTrip/member/service/MemberService.java @@ -100,7 +100,7 @@ public void checkUserPassword(String token, String password) { Member member = findMemberByToken(token); if (!passwordEncoder.encode(password).equals(member.getPassword())) - new BusinessLogicException(ExceptionCode.UNMATCHED_PASSWORD); + throw new BusinessLogicException(ExceptionCode.UNMATCHED_PASSWORD); } @@ -108,13 +108,14 @@ public void checkUserPassword(String token, String password) { public void verifyExistsEmail(String email) { Optional optionalMember = memberRepository.findByEmail(email); - if(optionalMember.isPresent()) new BusinessLogicException(ExceptionCode.MEMBER_EXISTS); + System.out.println(optionalMember); + if(optionalMember.isPresent()) throw new BusinessLogicException(ExceptionCode.MEMBER_EXISTS); } public void verifyExistsName(String name) { - Optional optionalMember = memberRepository.findByEmail(name); - if(optionalMember.isPresent()) new BusinessLogicException(ExceptionCode.MEMBER_EXISTS); + Optional optionalMember = memberRepository.findByName(name); + if(optionalMember.isPresent()) throw new BusinessLogicException(ExceptionCode.MEMBER_EXISTS); }