try to get the user in another way

pull/144/head
Henrique Dias 2017-04-16 13:29:57 +01:00
parent 7f95e5e6de
commit 00cbdd1833
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 2 additions and 2 deletions

View File

@ -51,8 +51,8 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return http.StatusForbidden, nil
}
// Obtains the user
username, _, _ := r.BasicAuth()
// Obtains the user. See https://github.com/mholt/caddy/blob/master/caddyhttp/basicauth/basicauth.go#L66
username, _ := r.Context().Value(httpserver.RemoteUserCtxKey).(string)
if _, ok := c.Users[username]; ok {
user = c.Users[username]
} else {