updated signature

This commit is contained in:
Colin Henry 2020-07-27 17:20:10 -07:00
parent 6d4ea1efb5
commit acc8d78947

View File

@ -5,7 +5,7 @@ import (
"os" "os"
) )
func BasicAuth(fn http.HandlerFunc) http.HandlerFunc { func BasicAuth(h http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
user, pass, _ := r.BasicAuth() user, pass, _ := r.BasicAuth()
if !(user == os.Getenv("WIKI_USERNAME") && pass == os.Getenv("WIKI_PASSWORD")) { if !(user == os.Getenv("WIKI_USERNAME") && pass == os.Getenv("WIKI_PASSWORD")) {
@ -13,6 +13,7 @@ func BasicAuth(fn http.HandlerFunc) http.HandlerFunc {
http.Error(w, "Unauthorized.", 401) http.Error(w, "Unauthorized.", 401)
return return
} }
fn(w, r)
h.ServeHTTP(w, r)
} }
} }