From cca13ae2acf1ef7a3b0516a8774dff0365b73697 Mon Sep 17 00:00:00 2001
From: bobemoe <inbox.github@jhodges.co.uk>
Date: Tue, 21 Jan 2020 22:51:39 +0000
Subject: [PATCH] add remote ip to the invalid credentials error message
 (#9918)

---
 routers/repo/http.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/routers/repo/http.go b/routers/repo/http.go
index d0a2b289b7..e0beba888e 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -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
 				}