diff --git a/internal/auth/service.go b/internal/auth/service.go index 051e703..37022c9 100644 --- a/internal/auth/service.go +++ b/internal/auth/service.go @@ -43,7 +43,7 @@ func (s *service) Login(ctx context.Context, username, password string) (*domain u, err := s.userSvc.FindByUsername(ctx, username) if err != nil { s.log.Error().Err(err).Msgf("could not find user by username: %v", username) - return nil, err + return nil, errors.Wrapf(err, "invalid login: %s", username) } if u == nil { @@ -58,7 +58,7 @@ func (s *service) Login(ctx context.Context, username, password string) (*domain if !match { s.log.Error().Msg("bad credentials") - return nil, errors.New("bad credentials") + return nil, errors.Errorf("invalid login: %s", username) } return u, nil diff --git a/internal/http/auth.go b/internal/http/auth.go index f9cdad4..ff35da2 100644 --- a/internal/http/auth.go +++ b/internal/http/auth.go @@ -75,7 +75,7 @@ func (h authHandler) login(w http.ResponseWriter, r *http.Request) { _, err := h.service.Login(ctx, data.Username, data.Password) if err != nil { - h.log.Error().Err(err).Msgf("invalid login [%s] from: %s", ReadUserIP(r)) + h.log.Error().Err(err).Msgf("Auth: Failed login attempt username: [%s] ip: %s", data.Username, ReadUserIP(r)) h.encoder.StatusResponse(ctx, w, nil, http.StatusUnauthorized) return }