Don't change realm between auth requests

This commit is contained in:
nemunaire 2018-09-18 19:46:15 +02:00
parent d4fd18bff3
commit 299140dab1
2 changed files with 2 additions and 2 deletions

2
api.go
View File

@ -57,7 +57,7 @@ func (a apiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if f.AuthFunction(user, sURL[1:]) {
ret, err = f.DispatchFunction(user, sURL[1:], r.Body)
} else {
w.Header().Set("WWW-Authenticate", "Basic realm=\"YouP0m API\"")
w.Header().Set("WWW-Authenticate", "Basic realm=\"YouP0m\"")
http.Error(w, "{errmsg:\"You are not allowed to do this request.\"}", http.StatusUnauthorized)
return
}

View File

@ -93,7 +93,7 @@ func main() {
mux.HandleFunc("/admin/", func(w http.ResponseWriter, r *http.Request) {
if authFunc(r) == nil {
w.Header().Set("WWW-Authenticate", "Basic realm=\"YouP0m Admin\"")
w.Header().Set("WWW-Authenticate", "Basic realm=\"YouP0m\"")
http.Error(w, "You are not allowed to perform this request.", http.StatusUnauthorized)
} else {
http.ServeFile(w, r, filepath.Join(staticDir, "admin.html"))