|
|
|
@ -253,6 +253,7 @@ func (m *DBModel) GetConfigOfSystem() (config ConfigSystem) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
ConfigSecurityMaxDocumentSize = "max_document_size" // 是否关闭注册
|
|
|
|
|
ConfigSecurityIsClose = "is_close" // 是否关闭注册
|
|
|
|
|
ConfigSecurityCloseStatement = "close_statement" // 闭站说明
|
|
|
|
|
ConfigSecurityEnableRegister = "enable_register" // 是否允许注册
|
|
|
|
@ -263,6 +264,7 @@ const (
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ConfigSecurity struct {
|
|
|
|
|
MaxDocumentSize int32 `json:"max_document_size"` // 允许上传的最大文档大小
|
|
|
|
|
IsClose bool `json:"is_close"` // 是否闭站
|
|
|
|
|
CloseStatement string `json:"close_statement"` // 闭站说明
|
|
|
|
|
EnableRegister bool `json:"enable_register"` // 是否启用注册
|
|
|
|
@ -291,6 +293,8 @@ func (m *DBModel) GetConfigOfSecurity(name ...string) (config ConfigSecurity) {
|
|
|
|
|
case "is_close", "enable_register", "enable_captcha_login", "enable_captcha_register", "enable_captcha_comment", "enable_captcha_find_password", "enable_captcha_upload":
|
|
|
|
|
value, _ := strconv.ParseBool(cfg.Value)
|
|
|
|
|
data[cfg.Name] = value
|
|
|
|
|
case "max_document_size":
|
|
|
|
|
data[cfg.Name], _ = strconv.Atoi(cfg.Value)
|
|
|
|
|
default:
|
|
|
|
|
data[cfg.Name] = cfg.Value
|
|
|
|
|
}
|
|
|
|
@ -359,6 +363,7 @@ func (m *DBModel) initConfig() (err error) {
|
|
|
|
|
{Category: ConfigCategoryCaptcha, Name: ConfigCaptchaType, Label: "验证码类型", Value: "digit", Placeholder: "请选择验证码类型,默认为数字", InputType: "select", Sort: 16, Options: captcha.CaptchaTypeOptions},
|
|
|
|
|
|
|
|
|
|
// 安全配置项
|
|
|
|
|
{Category: ConfigCategorySecurity, Name: ConfigSecurityMaxDocumentSize, Label: "最大文档大小(MB)", Value: "50", Placeholder: "允许用户上传的最大文档大小,默认为50,即50MB", InputType: "number", Sort: 15, Options: ""},
|
|
|
|
|
{Category: ConfigCategorySecurity, Name: ConfigSecurityIsClose, Label: "是否关闭网站", Value: "false", Placeholder: "请选择是否关闭网站", InputType: "switch", Sort: 16, Options: ""},
|
|
|
|
|
{Category: ConfigCategorySecurity, Name: ConfigSecurityCloseStatement, Label: "闭站说明", Value: "false", Placeholder: "关闭网站后,页面提示的内容", InputType: "textarea", Sort: 17, Options: ""},
|
|
|
|
|
{Category: ConfigCategorySecurity, Name: ConfigSecurityEnableRegister, Label: "是否允许注册", Value: "true", Placeholder: "请选择是否允许用户注册", InputType: "switch", Sort: 18, Options: ""},
|
|
|
|
|