From fff2488058a265eba8a28158d2b7326db696b55f Mon Sep 17 00:00:00 2001 From: JustSong Date: Wed, 21 Dec 2022 11:47:27 +0800 Subject: [PATCH] fix: check if user's GitHub display name is empty --- controller/github.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/github.go b/controller/github.go index 7fc446f..4924425 100644 --- a/controller/github.go +++ b/controller/github.go @@ -116,7 +116,11 @@ func GitHubOAuth(c *gin.Context) { } else { if common.RegisterEnabled { user.Username = "github_" + strconv.Itoa(model.GetMaxUserId()+1) - user.DisplayName = githubUser.Name + if githubUser.Name != "" { + user.DisplayName = githubUser.Name + } else { + user.DisplayName = "GitHub User" + } user.Email = githubUser.Email user.Role = common.RoleCommonUser user.Status = common.UserStatusEnabled