Improve logging #17

Merged
june merged 5 commits from :Bendodroid-betterLogging into main 2024-01-15 22:36:34 +01:00
Showing only changes of commit 7ac8e91cc2 - Show all commits

View file

@ -18,7 +18,7 @@ func updateEndpointValidator(
// Check BasicAuth credentials // Check BasicAuth credentials
username, password, ok := r.BasicAuth() username, password, ok := r.BasicAuth()
if !ok || !util.CheckCredentials(authDB, validCredentials, username, password) { if !ok || !util.CheckCredentials(authDB, validCredentials, username, password) {
log.Println("Unauthorized request from", r.RemoteAddr) log.Println("Unauthorized request from", r.RemoteAddr, "Username:", username, "Password:", password)
w.Header().Set("WWW-Authenticate", "Basic realm=\"space-api\"") w.Header().Set("WWW-Authenticate", "Basic realm=\"space-api\"")
w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
return return