Skip to content

Commit

Permalink
닉네임 중복 검사
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeSung98 committed Nov 28, 2023
1 parent 7764e32 commit 7c858bf
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public void signup(UserDTO userDTO) {
throw new Error("이미 존재하는 이메일입니다.");
}

optionalUser = userRepository.findByNickname(userDTO.getNickname());

if(optionalUser.isPresent()) {
throw new Error("이미 존재하는 닉네임입니다.");
}

userDTO.setPassword(passwordEncoder.encode(userDTO.getPassword()));
userDTO.setStatus(true);
User user = dtoToEntity(userDTO);
Expand Down

0 comments on commit 7c858bf

Please sign in to comment.