Skip to content

Commit

Permalink
소셜 연동할때 email null인거 허용 (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
asp345 authored Oct 6, 2024
1 parent 7715dbb commit 22bc3ef
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/kotlin/users/service/UserService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,13 @@ class UserServiceImpl(
): TokenResponse {
val token = socialLoginRequest.token
val oauth2UserResponse = authService.socialLoginWithAccessToken(socialProvider, token)
val presentUser = userRepository.findByEmailIgnoreCaseAndIsEmailVerifiedTrueAndActiveTrue(oauth2UserResponse.email!!)

if (presentUser != null && presentUser.id != user.id) {
throw DuplicateEmailException(socialProvider)
if (oauth2UserResponse.email != null) {
val presentUser = userRepository.findByEmailIgnoreCaseAndIsEmailVerifiedTrueAndActiveTrue(oauth2UserResponse.email)
if (presentUser != null && presentUser.id != user.id) {
throw DuplicateEmailException(socialProvider)
}
}

when (socialProvider) {
SocialProvider.FACEBOOK -> {
if (user.credential.fbId != null) throw AlreadySocialAccountException
Expand Down

0 comments on commit 22bc3ef

Please sign in to comment.