Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle missing name for social bingding #57

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/run/halo/oauth/UserConnectionServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.web.server.ServerWebInputException;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import run.halo.app.core.extension.UserConnection;
Expand Down Expand Up @@ -112,7 +111,8 @@ UserConnection convert(String username, OAuth2LoginAuthenticationToken authentic

Oauth2UserProfile oauth2UserProfile =
oauth2UserProfileMapperManager.mapProfile(registrationId, oauth2User);
spec.setDisplayName(oauth2UserProfile.getDisplayName());
var displayName = StringUtils.defaultIfBlank(oauth2UserProfile.getDisplayName(), username);
spec.setDisplayName(displayName);
spec.setAvatarUrl(oauth2UserProfile.getAvatarUrl());
spec.setProfileUrl(oauth2UserProfile.getProfileUrl());
return userConnection;
Expand Down