]> source.dussan.org Git - gitea.git/commitdiff
add remote ip to the invalid credentials error message (#9918)
authorbobemoe <inbox.github@jhodges.co.uk>
Tue, 21 Jan 2020 22:51:39 +0000 (22:51 +0000)
committertechknowlogick <techknowlogick@gitea.io>
Tue, 21 Jan 2020 22:51:39 +0000 (17:51 -0500)
routers/repo/http.go

index d0a2b289b710de4af400de423bfbbc86c00c7065..e0beba888ea5b9526ce4a3d6c9c4910c04d32c51 100644 (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
                                }