From a0f16aa04e5336c3fc783b8589428ff5fccc152b Mon Sep 17 00:00:00 2001 From: Urko Date: Fri, 7 Jul 2023 23:41:51 +0200 Subject: [PATCH] log IP --- internal/api/handler/prosody_hdl.go | 2 -- internal/api/server.go | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/api/handler/prosody_hdl.go b/internal/api/handler/prosody_hdl.go index a39f214..76102c6 100644 --- a/internal/api/handler/prosody_hdl.go +++ b/internal/api/handler/prosody_hdl.go @@ -2,7 +2,6 @@ package handler import ( "fmt" - "log" "gitea.urkob.com/urko/prosody-password/internal/services/fail2ban" "gitea.urkob.com/urko/prosody-password/internal/services/prosody" @@ -34,7 +33,6 @@ func (handler ProsodyHandler) Post(c *fiber.Ctx) error { } if err := handler.prosodyService.ChangePassword(req.User, req.CurrentPassword, req.NewPassword); err != nil { - log.Println("c.IPs()", c.IPs()) for _, ip := range c.IPs() { handler.fail2banSrv.FailedAttempt(ip) } diff --git a/internal/api/server.go b/internal/api/server.go index 2059c99..28c4960 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -46,6 +46,8 @@ func (s *RestServer) Start(apiPort, views string) error { prosodyHdl := handler.NewProsodyHandler(s.prosodyService, s.fail2banSrv) s.app.Post("/changePassword", func(c *fiber.Ctx) error { + log.Println("c.IPs()", c.IPs()) + log.Println("c.IP", c.IP()) for _, ip := range c.IPs() { if !s.fail2banSrv.CanChangePassword(ip) { return handler.RenderError(c, fmt.Errorf("id is empty"), "Too many tries, blocked for 1h")