fixed auth check
thats why we test
This commit is contained in:
parent
339dbe617f
commit
3de0aaeec8
@ -193,13 +193,13 @@ func getShareHead(client *client.Client, w http.ResponseWriter, r *http.Request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkAuth(w http.ResponseWriter, r *http.Request, username, password string) bool {
|
func checkAuth(w http.ResponseWriter, r *http.Request, username, password string) bool {
|
||||||
username, password, ok := r.BasicAuth()
|
authUsername, authPassword, ok := r.BasicAuth()
|
||||||
if !ok {
|
if !ok {
|
||||||
w.WriteHeader(http.StatusUnauthorized)
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if username != username || password != password {
|
if username != authUsername || password != authPassword {
|
||||||
w.WriteHeader(http.StatusUnauthorized)
|
w.WriteHeader(http.StatusUnauthorized)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user