harness-drone/handler/web/logout.go

24 lines
605 B
Go
Raw Normal View History

2019-02-19 23:56:41 +00:00
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
package web
import (
"net/http"
"github.com/drone/drone-ui/dist"
)
// HandleLogout creates an http.HandlerFunc that handles
// session termination.
func HandleLogout() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Set-Cookie", "_session_=deleted; Path=/; Max-Age=0")
w.Header().Set("Content-Type", "text/html; charset=UTF-8")
w.Write(
dist.MustLookup("/index.html"),
)
}
}