aboutsummaryrefslogtreecommitdiffstats
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/server.go b/server.go
index 4bdd15b..c6d61e8 100644
--- a/server.go
+++ b/server.go
@@ -238,6 +238,15 @@ func New(imapURL string) *echo.Echo {
e.GET("/login", handleLogin)
e.POST("/login", handleLogin)
+ e.GET("/logout", func(ectx echo.Context) error {
+ ctx := ectx.(*context)
+ if err := ctx.conn.Logout(); err != nil {
+ return err
+ }
+ ctx.setToken("")
+ return ctx.Redirect(http.StatusFound, "/login")
+ })
+
e.Static("/assets", "public/assets")
return e