diff --git a/common/constants.go b/common/constants.go index 2a85984..daf3f5a 100644 --- a/common/constants.go +++ b/common/constants.go @@ -24,7 +24,7 @@ var ItemsPerPage = 10 var PasswordLoginEnabled = true var RegisterEnabled = true var EmailVerificationEnabled = false -var GitHubOAuthEnabled = true +var GitHubOAuthEnabled = false var SMTPServer = "" var SMTPAccount = "" diff --git a/controller/option.go b/controller/option.go index 740acb7..d35b1ae 100644 --- a/controller/option.go +++ b/controller/option.go @@ -39,6 +39,13 @@ func UpdateOption(c *gin.Context) { }) return } + if option.Key == "GitHubOAuthEnabled" && option.Value == "true" && common.GitHubClientId == "" { + c.JSON(http.StatusOK, gin.H{ + "success": false, + "message": "无法启用 GitHub OAuth,请先填入 GitHub Client ID 以及 GitHub Client Secret!", + }) + return + } err = model.UpdateOption(option.Key, option.Value) if err != nil { c.JSON(http.StatusOK, gin.H{