mirror of https://github.com/ouqiang/gocron
邮件服务器配置-增加清空功能
parent
428275f813
commit
0f5c4c3e2a
|
@ -105,6 +105,14 @@ func UpdateMailServer(ctx *macaron.Context, form MailServerForm) string {
|
|||
return utils.JsonResponseByErr(err)
|
||||
}
|
||||
|
||||
func ClearMailServer(ctx *macaron.Context) string {
|
||||
jsonByte, _ := json.Marshal(MailServerForm{})
|
||||
settingModel := new(models.Setting)
|
||||
_, err := settingModel.UpdateMailServer(string(jsonByte))
|
||||
|
||||
return utils.JsonResponseByErr(err)
|
||||
}
|
||||
|
||||
func CreateMailUser(ctx *macaron.Context) string {
|
||||
username := ctx.QueryTrim("username")
|
||||
email := ctx.QueryTrim("email")
|
||||
|
|
|
@ -80,6 +80,7 @@ func Register(m *macaron.Macaron) {
|
|||
m.Get("/", manage.Mail)
|
||||
m.Get("/edit", manage.EditMail)
|
||||
m.Post("/server", binding.Bind(manage.MailServerForm{}), manage.UpdateMailServer)
|
||||
m.Post("/server/clear", manage.ClearMailServer)
|
||||
m.Post("/user", manage.CreateMailUser)
|
||||
m.Post("/user/remove/:id", manage.RemoveMailUser)
|
||||
})
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<button class="ui primary button">保存</button>
|
||||
{{{if .Mail.Host}}}
|
||||
<a class="ui green button" onclick="clearMailServer()">删除</a>
|
||||
{{{end}}}
|
||||
<br><br><br>
|
||||
<div>
|
||||
<div class="content">邮箱用户</div><p></p>
|
||||
|
@ -98,7 +101,7 @@
|
|||
util.post('/manage/mail/server',
|
||||
fields,
|
||||
function(code, message) {
|
||||
util.alertSuccess();
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
return false;
|
||||
|
@ -188,5 +191,11 @@
|
|||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function clearMailServer() {
|
||||
util.post('/manage/mail/server/clear', {}, function(code, message) {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{{{ template "common/footer" . }}}
|
Loading…
Reference in New Issue