diff options
Diffstat (limited to 'api4/system.go')
-rw-r--r-- | api4/system.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api4/system.go b/api4/system.go index 4f86213c6..f7a3918a5 100644 --- a/api4/system.go +++ b/api4/system.go @@ -17,12 +17,29 @@ func InitSystem() { BaseRoutes.System.Handle("/ping", ApiHandler(getSystemPing)).Methods("GET") BaseRoutes.ApiRoot.Handle("/config", ApiSessionRequired(getConfig)).Methods("GET") + BaseRoutes.ApiRoot.Handle("/email/test", ApiSessionRequired(testEmail)).Methods("POST") } func getSystemPing(c *Context, w http.ResponseWriter, r *http.Request) { ReturnStatusOK(w) } +func testEmail(c *Context, w http.ResponseWriter, r *http.Request) { + + if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) { + c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM) + return + } + + err := app.TestEmail(c.Session.UserId, utils.Cfg) + if err != nil { + c.Err = err + return + } + + ReturnStatusOK(w) +} + func getConfig(c *Context, w http.ResponseWriter, r *http.Request) { if !app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) { c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM) |