Clear old monitoring snapshots, logout endpoint

This commit is contained in:
simon987
2019-02-09 19:05:45 -05:00
parent a6802c7109
commit a90b73ad70
13 changed files with 75 additions and 19 deletions

View File

@@ -77,6 +77,13 @@ func (api *WebAPI) Login(r *Request) {
}).Info("Logged in")
}
func (api *WebAPI) Logout(r *Request) {
sess := api.Session.StartFasthttp(r.Ctx)
sess.Clear()
r.Ctx.Response.SetStatusCode(204)
}
func (api *WebAPI) Register(r *Request) {
req := &RegisterRequest{}

View File

@@ -102,6 +102,7 @@ func New() *WebAPI {
api.router.POST("/register", LogRequestMiddleware(api.Register))
api.router.POST("/login", LogRequestMiddleware(api.Login))
api.router.GET("/logout", LogRequestMiddleware(api.Logout))
api.router.GET("/account", LogRequestMiddleware(api.AccountDetails))
api.router.NotFound = func(ctx *fasthttp.RequestCtx) {