Browse Source

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

for-closed-social
bobemoe 4 years ago
committed by techknowlogick
parent
commit
cca13ae2ac
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      routers/repo/http.go

+ 3
- 3
routers/repo/http.go 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
}

Loading…
Cancel
Save