diff --git a/internal/handlers/auth.go b/internal/handlers/auth.go index 07c2ff4..b02e60b 100644 --- a/internal/handlers/auth.go +++ b/internal/handlers/auth.go @@ -103,6 +103,20 @@ func (h *AuthHandler) Register(c echo.Context) error { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) } + // Additional validation: Trim whitespace from username + req.Username = strings.TrimSpace(req.Username) + if req.Username == "" { + if c.Request().Header.Get("HX-Request") == "true" { + return c.HTML(http.StatusBadRequest, `