DEVELOPMENT ENVIRONMENT

~liljamo/felu

718ba8a948df3e8990e393575be4c667c339e459 — Jonni Liljamo 1 year, 1 month ago 24b5b31
feat: don't allow full stops in domains
1 files changed, 6 insertions(+), 0 deletions(-)

M internal/handlers/domains.go
M internal/handlers/domains.go => internal/handlers/domains.go +6 -0
@@ 10,6 10,7 @@ import (
	"log"
	"net"
	"net/http"
	"strings"

	"git.src.quest/~skye/felu-ddns/internal/db"
	"github.com/gin-gonic/gin"


@@ 34,6 35,11 @@ func PostDomain() gin.HandlerFunc {
			c.Abort()
			return
		}
		if strings.Contains(data.Domain, ".") {
			c.String(http.StatusBadRequest, "Domain can't contain full stops")
			c.Abort()
			return
		}
		if net.ParseIP(data.ARecord).To4() == nil {
			c.String(http.StatusBadRequest, "The A record is invalid")
			c.Abort()