0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-26 14:12:58 +01:00

add remote ip to the invalid credentials error message (#9918)

This commit is contained in:
bobemoe 2020-01-21 22:51:39 +00:00 committed by techknowlogick
parent 38a6b11015
commit cca13ae2ac

View file

@ -198,14 +198,14 @@ func HTTP(ctx *context.Context) {
authUser, err = models.GetUserByName(authUsername)
if err != nil {
if models.IsErrUserNotExist(err) {
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
} else {
ctx.ServerError("GetUserByName", err)
}
return
}
if authUser.ID != token.UID {
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
return
}
}
@ -231,7 +231,7 @@ func HTTP(ctx *context.Context) {
}
if authUser == nil {
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
return
}