Skip to content

Commit

Permalink
dont link social users with null emails to users with null emails
Browse files Browse the repository at this point in the history
  • Loading branch information
ruddell committed Aug 25, 2016
1 parent 0cfb097 commit de32e3f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ private User createUserIfNotExist(UserProfile userProfile, String langKey, Strin
log.error("Cannot create social user because email is null and login already exist, login -> {}", userName);
throw new IllegalArgumentException("Email cannot be null with an existing login");
}
Optional<User> user = userRepository.findOneByEmail(email);
if (user.isPresent()) {
log.info("User already exist associate the connection to this account");
return user.get();
if (!StringUtils.isBlank(email)) {
Optional<User> user = userRepository.findOneByEmail(email);
if (user.isPresent()) {
log.info("User already exist associate the connection to this account");
return user.get();
}
}

String login = getLoginDependingOnProviderId(userProfile, providerId);
Expand Down

0 comments on commit de32e3f

Please sign in to comment.