From 5727708bbd3155b38577e90221dd09728b084ed1 Mon Sep 17 00:00:00 2001 From: EUForest Date: Mon, 9 Mar 2026 22:54:33 +0800 Subject: [PATCH] feat(config): add captcha configuration to global config response - Add CaptchaType field to verify config - Add EnableUserLoginCaptcha field - Add EnableUserRegisterCaptcha field - Add EnableAdminLoginCaptcha field - Add EnableUserResetPasswordCaptcha field - Expose captcha configuration to frontend --- internal/logic/common/getGlobalConfigLogic.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/logic/common/getGlobalConfigLogic.go b/internal/logic/common/getGlobalConfigLogic.go index 393371b..e3c3b90 100644 --- a/internal/logic/common/getGlobalConfigLogic.go +++ b/internal/logic/common/getGlobalConfigLogic.go @@ -41,27 +41,26 @@ func (l *GetGlobalConfigLogic) GetGlobalConfig() (resp *types.GetGlobalConfigRes l.Logger.Error("[GetGlobalConfigLogic] GetVerifyCodeConfig error: ", logger.Field("error", err.Error())) return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "GetVerifyCodeConfig error: %v", err.Error()) } + verifyCfg, err := l.svcCtx.SystemModel.GetVerifyConfig(l.ctx) + if err != nil { + l.Logger.Error("[GetGlobalConfigLogic] GetVerifyConfig error: ", logger.Field("error", err.Error())) + return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "GetVerifyConfig error: %v", err.Error()) + } tool.DeepCopy(&resp.Site, l.svcCtx.Config.Site) tool.DeepCopy(&resp.Subscribe, l.svcCtx.Config.Subscribe) tool.DeepCopy(&resp.Auth.Email, l.svcCtx.Config.Email) tool.DeepCopy(&resp.Auth.Mobile, l.svcCtx.Config.Mobile) tool.DeepCopy(&resp.Auth.Register, l.svcCtx.Config.Register) - tool.DeepCopy(&resp.Verify, l.svcCtx.Config.Verify) tool.DeepCopy(&resp.Invite, l.svcCtx.Config.Invite) tool.SystemConfigSliceReflectToStruct(currencyCfg, &resp.Currency) tool.SystemConfigSliceReflectToStruct(verifyCodeCfg, &resp.VerifyCode) + tool.SystemConfigSliceReflectToStruct(verifyCfg, &resp.Verify) if report.IsGatewayMode() { resp.Subscribe.SubscribePath = "/sub" + l.svcCtx.Config.Subscribe.SubscribePath } - resp.Verify = types.VeifyConfig{ - TurnstileSiteKey: l.svcCtx.Config.Verify.TurnstileSiteKey, - EnableLoginVerify: l.svcCtx.Config.Verify.LoginVerify, - EnableRegisterVerify: l.svcCtx.Config.Verify.RegisterVerify, - EnableResetPasswordVerify: l.svcCtx.Config.Verify.ResetPasswordVerify, - } var methods []string // auth methods