summaryrefslogtreecommitdiffstats
path: root/api4/system.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-13 16:09:00 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 15:09:00 +0000
commit38958d9ac4f415d9ae99dfcdb53bfdc355d96764 (patch)
tree6a92500ed7b9f13f0da0c1f84fc43b674621b36e /api4/system.go
parent19c67d7fe35f92ae8a288dcdb9877d3bede41a61 (diff)
downloadchat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.tar.gz
chat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.tar.bz2
chat-38958d9ac4f415d9ae99dfcdb53bfdc355d96764.zip
Add implementation for POST /email/test apiV4 - Send Test Email (#5716)
Diffstat (limited to 'api4/system.go')
-rw-r--r--api4/system.go17
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)