mirror of
https://github.com/MarekWojt/gertdns.git
synced 2025-12-15 12:59:53 +01:00
more sensible error handling: auth failure
This commit is contained in:
@@ -189,6 +189,12 @@ func authenticatedRequest(request func(ctx *fasthttp.RequestCtx)) func(ctx *fast
|
||||
}
|
||||
|
||||
authenticated, err := auth.IsPasswordAuthenticated(authRequest)
|
||||
if err != nil && !authenticated {
|
||||
ctx.WriteString("Authentication failed: " + err.Error())
|
||||
ctx.SetStatusCode(fasthttp.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
ctx.WriteString("Internal server error")
|
||||
ctx.SetStatusCode(fasthttp.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user