迁移公告,邮件
This commit is contained in:
@@ -38,6 +38,7 @@ func registerSystemConfigRoutes(group *gin.RouterGroup, config *conf.AdminBacken
|
||||
system := group.Group("/system")
|
||||
system.POST("/getSystemConfig", func(c *gin.Context) {
|
||||
admin := gin.H{"routerPrefix": ""}
|
||||
email := gin.H{}
|
||||
if config != nil {
|
||||
admin["routerPrefix"] = config.RouterPrefix
|
||||
if config.Jwt != nil {
|
||||
@@ -49,8 +50,11 @@ func registerSystemConfigRoutes(group *gin.RouterGroup, config *conf.AdminBacken
|
||||
if config.Local != nil {
|
||||
admin["local"] = gin.H{"storePath": config.Local.StorePath, "pathPrefix": config.Local.PathPrefix}
|
||||
}
|
||||
if config.Email != nil {
|
||||
email = gin.H{"to": config.Email.To, "from": config.Email.From, "host": config.Email.Host, "secret": "******", "nickname": config.Email.Nickname, "port": config.Email.Port, "is-ssl": config.Email.IsSsl, "is-loginauth": config.Email.IsLoginAuth}
|
||||
}
|
||||
}
|
||||
writeResult(c, codeSuccess, gin.H{"config": gin.H{"admin": admin}}, "获取成功")
|
||||
writeResult(c, codeSuccess, gin.H{"config": gin.H{"admin": admin, "email": email}}, "获取成功")
|
||||
})
|
||||
system.POST("/setSystemConfig", func(c *gin.Context) {
|
||||
var req struct {
|
||||
@@ -66,6 +70,16 @@ func registerSystemConfigRoutes(group *gin.RouterGroup, config *conf.AdminBacken
|
||||
PathPrefix string `json:"pathPrefix"`
|
||||
} `json:"local"`
|
||||
} `json:"admin"`
|
||||
Email *struct {
|
||||
To string `json:"to"`
|
||||
From string `json:"from"`
|
||||
Host string `json:"host"`
|
||||
Secret string `json:"secret"`
|
||||
Nickname string `json:"nickname"`
|
||||
Port int32 `json:"port"`
|
||||
IsSSL bool `json:"is-ssl"`
|
||||
IsLoginAuth bool `json:"is-loginauth"`
|
||||
} `json:"email"`
|
||||
} `json:"config"`
|
||||
}
|
||||
if c.ShouldBindJSON(&req) != nil {
|
||||
@@ -90,6 +104,18 @@ func registerSystemConfigRoutes(group *gin.RouterGroup, config *conf.AdminBacken
|
||||
config.Local.PathPrefix = req.Config.Admin.Local.PathPrefix
|
||||
}
|
||||
}
|
||||
if config.Email != nil && req.Config.Email != nil {
|
||||
config.Email.To = req.Config.Email.To
|
||||
config.Email.From = req.Config.Email.From
|
||||
config.Email.Host = req.Config.Email.Host
|
||||
config.Email.Nickname = req.Config.Email.Nickname
|
||||
config.Email.Port = req.Config.Email.Port
|
||||
config.Email.IsSsl = req.Config.Email.IsSSL
|
||||
config.Email.IsLoginAuth = req.Config.Email.IsLoginAuth
|
||||
if req.Config.Email.Secret != "" && req.Config.Email.Secret != "******" {
|
||||
config.Email.Secret = req.Config.Email.Secret
|
||||
}
|
||||
}
|
||||
}
|
||||
ok(c)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user