harness-drone/handler/web/logout.go
2019-02-19 15:56:41 -08:00

23 lines
605 B
Go

// 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"),
)
}
}