Skip to content

Commit

Permalink
카카오회원가입시 Email 중복 검증 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
juwum12 committed Apr 6, 2024
1 parent 6588c03 commit 5aa42cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/com/nawabali/nawabali/service/KakaoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,11 @@ private String getAccessToken(String code, String redirect_uri) throws JsonProce
private User registerKakaoUserIfNeeded(String accessToken) throws JsonProcessingException {
KakaoDto.userInfoDto kakaoUserInfo = getKakaoUserInfo(accessToken);

// DB 에 중복된 Kakao Id 가 있는지 확인
String kakaoId = String.valueOf(kakaoUserInfo.getId());
User kakaoUser = userRepository.findByKakaoId(kakaoId).orElse(null);
// DB 에 중복된 Kakao Email 가 있는지 확인
String kakaoEmail = String.valueOf(kakaoUserInfo.getEmail());
User kakaoUser = userRepository.findByEmail(kakaoEmail).orElse(null);

if (kakaoUser == null) {
String kakaoEmail = kakaoUserInfo.getEmail(); // 카카오 사용자 이메일
String kakaoNickname = kakaoUserInfo.getNickname(); // 카카오 사용자 닉네임
String password = passwordEncoder.encode(UUID.randomUUID().toString());

Expand Down

0 comments on commit 5aa42cf

Please sign in to comment.