log IP
This commit is contained in:
parent
44c8c96fbd
commit
a0f16aa04e
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue