Jelajahi Sumber

fix: check if user's GitHub display name is empty

JustSong 3 tahun lalu
induk
melakukan
fff2488058
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      controller/github.go

+ 5 - 1
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