Skip to content

Commit

Permalink
Fix: 중복회원가입 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
s2hoon committed Jan 10, 2024
1 parent c88ce64 commit 7c73a7c
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions src/main/java/com/umc/StudyFlexBE/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}


Expand Down

0 comments on commit 7c73a7c

Please sign in to comment.