From 9ca2996306cbdf0211a0344bd5a9492c1697fa18 Mon Sep 17 00:00:00 2001 From: kleinsea Date: Fri, 28 May 2021 18:52:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=BD=E5=8A=A0config=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=8F=82=E6=95=B0:=20registerEnabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/serializer/setting.go | 2 ++ routers/controllers/site.go | 1 + 2 files changed, 3 insertions(+) diff --git a/pkg/serializer/setting.go b/pkg/serializer/setting.go index 5906e818..28fd8dd7 100644 --- a/pkg/serializer/setting.go +++ b/pkg/serializer/setting.go @@ -22,6 +22,7 @@ type SiteConfig struct { ReCaptchaKey string `json:"captcha_ReCaptchaKey"` CaptchaType string `json:"captcha_type"` TCaptchaCaptchaAppId string `json:"tcaptcha_captcha_app_id"` + RegisterEnabled bool `json:"registerEnabled"` } type task struct { @@ -83,6 +84,7 @@ func BuildSiteConfig(settings map[string]string, user *model.User) Response { ReCaptchaKey: checkSettingValue(settings, "captcha_ReCaptchaKey"), CaptchaType: checkSettingValue(settings, "captcha_type"), TCaptchaCaptchaAppId: checkSettingValue(settings, "captcha_TCaptcha_CaptchaAppId"), + RegisterEnabled: model.IsTrueVal(checkSettingValue(settings, "register_enabled")), }} return res } diff --git a/routers/controllers/site.go b/routers/controllers/site.go index 056a9827..f74534dc 100644 --- a/routers/controllers/site.go +++ b/routers/controllers/site.go @@ -27,6 +27,7 @@ func SiteConfig(c *gin.Context) { "captcha_ReCaptchaKey", "captcha_type", "captcha_TCaptcha_CaptchaAppId", + "register_enabled", ) // 如果已登录,则同时返回用户信息和标签