diff --git a/public/mailbox.html b/public/mailbox.html index 282f462..c4ff097 100644 --- a/public/mailbox.html +++ b/public/mailbox.html @@ -2,6 +2,8 @@

koushin

+Logout +

{{.Mailbox.Name}}

Mailboxes:

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