Don't change realm between auth requests
This commit is contained in:
parent
d4fd18bff3
commit
299140dab1
2
api.go
2
api.go
@ -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
|
||||
}
|
||||
|
2
main.go
2
main.go
@ -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"))
|
||||
|
Loading…
Reference in New Issue
Block a user