Skip to content

Commit cca13ae

Browse files
bobemoetechknowlogick
authored andcommitted
add remote ip to the invalid credentials error message (#9918)
1 parent 38a6b11 commit cca13ae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

routers/repo/http.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ func HTTP(ctx *context.Context) {
198198
authUser, err = models.GetUserByName(authUsername)
199199
if err != nil {
200200
if models.IsErrUserNotExist(err) {
201-
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
201+
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
202202
} else {
203203
ctx.ServerError("GetUserByName", err)
204204
}
205205
return
206206
}
207207
if authUser.ID != token.UID {
208-
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
208+
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
209209
return
210210
}
211211
}
@@ -231,7 +231,7 @@ func HTTP(ctx *context.Context) {
231231
}
232232

233233
if authUser == nil {
234-
ctx.HandleText(http.StatusUnauthorized, "invalid credentials")
234+
ctx.HandleText(http.StatusUnauthorized, fmt.Sprintf("invalid credentials from %s", ctx.RemoteAddr()))
235235
return
236236
}
237237

0 commit comments

Comments
 (0)