Skip to content

Commit

Permalink
fix: check GitHubClientId before enable GitHub OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Oct 30, 2022
1 parent 2899649 commit 70d21b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
7 changes: 7 additions & 0 deletions controller/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 70d21b8

Please sign in to comment.