Add simple sanitsation to subscriber name
This commit is contained in:
parent
f9c83e6432
commit
ad96a4341c
|
@ -178,14 +178,12 @@ func handleCreateSubscriber(c echo.Context) error {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
|
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
|
|
||||||
|
|
||||||
// Insert and read ID.
|
// Insert and read ID.
|
||||||
var newID int
|
var newID int
|
||||||
err := app.Queries.UpsertSubscriber.Get(&newID,
|
err := app.Queries.UpsertSubscriber.Get(&newID,
|
||||||
uuid.NewV4(),
|
uuid.NewV4(),
|
||||||
req.Email,
|
strings.ToLower(strings.TrimSpace(req.Email)),
|
||||||
req.Name,
|
strings.TrimSpace(req.Name),
|
||||||
req.Status,
|
req.Status,
|
||||||
req.Attribs,
|
req.Attribs,
|
||||||
true,
|
true,
|
||||||
|
@ -227,11 +225,9 @@ func handleUpdateSubscriber(c echo.Context) error {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, "Invalid length for `name`.")
|
return echo.NewHTTPError(http.StatusBadRequest, "Invalid length for `name`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
|
|
||||||
|
|
||||||
_, err := app.Queries.UpdateSubscriber.Exec(req.ID,
|
_, err := app.Queries.UpdateSubscriber.Exec(req.ID,
|
||||||
req.Email,
|
strings.ToLower(strings.TrimSpace(req.Email)),
|
||||||
req.Name,
|
strings.TrimSpace(req.Name),
|
||||||
req.Status,
|
req.Status,
|
||||||
req.Attribs,
|
req.Attribs,
|
||||||
req.Lists)
|
req.Lists)
|
||||||
|
|
Loading…
Reference in New Issue