From 7c73a7cf1db2193e83e7d2f64a7fa343d2b816f8 Mon Sep 17 00:00:00 2001 From: suhoon Date: Wed, 10 Jan 2024 23:55:40 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=A4=91=EB=B3=B5=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StudyFlexBE/service/MemberService.java | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/umc/StudyFlexBE/service/MemberService.java b/src/main/java/com/umc/StudyFlexBE/service/MemberService.java index 36610ed..e69b7de 100644 --- a/src/main/java/com/umc/StudyFlexBE/service/MemberService.java +++ b/src/main/java/com/umc/StudyFlexBE/service/MemberService.java @@ -59,26 +59,34 @@ public boolean checkEmail(String email) { @Transactional public void signUp(SignUpDto signUpDto) { - Member member = new Member(); - member.setMember_type(general); - member.setEmail(signUpDto.getEmail()); - member.setPassword(passwordEncoder.encode(signUpDto.getPassword())); - member.setName(signUpDto.getName()); - member.setSchool(signUpDto.getSchool()); - member.setRole(ROLE_USER); - memberRepository.save(member); + if (checkEmail(signUpDto.getEmail()) == true) { + Member member = new Member(); + member.setMember_type(general); + member.setEmail(signUpDto.getEmail()); + member.setPassword(passwordEncoder.encode(signUpDto.getPassword())); + member.setName(signUpDto.getName()); + member.setSchool(signUpDto.getSchool()); + member.setRole(ROLE_USER); + memberRepository.save(member); + }else{ + throw new BaseException(BaseResponseStatus.DUPLICATE_EMAIL); + } } @Transactional public void signUpOAUth(SignUpOAuthDto signUpOAuthDto) { - Member member = new Member(); - member.setMember_type(general); - member.setRole(ROLE_USER); - member.setEmail(signUpOAuthDto.getEmail()); - member.setName(signUpOAuthDto.getName()); - member.setPassword(passwordEncoder.encode("12345")); - member.setSchool(signUpOAuthDto.getSchool()); - memberRepository.save(member); + if(checkEmail(signUpOAuthDto.getEmail())==true) { + Member member = new Member(); + member.setMember_type(general); + member.setRole(ROLE_USER); + member.setEmail(signUpOAuthDto.getEmail()); + member.setName(signUpOAuthDto.getName()); + member.setPassword(passwordEncoder.encode("12345")); + member.setSchool(signUpOAuthDto.getSchool()); + memberRepository.save(member); + } else{ + throw new BaseException(BaseResponseStatus.DUPLICATE_EMAIL); + } }