🔒fix(delivery): fixed the security problem of the create benefactor kinfboxreq

This commit is contained in:
mohammad mahdi rezaei 2024-01-24 18:44:13 +03:30
parent d829192bd6
commit aa129a870e
1 changed files with 3 additions and 2 deletions

View File

@ -10,11 +10,12 @@ import (
)
func (h Handler) Add(c echo.Context) error {
claims := claim.GetClaimsFromEchoContext(c)
req := param.KindBoxReqAddRequest{BenefactorID: claims.UserID}
req := param.KindBoxReqAddRequest{}
if bErr := c.Bind(&req); bErr != nil {
return echo.NewHTTPError(http.StatusBadRequest)
}
claims := claim.GetClaimsFromEchoContext(c)
req.BenefactorID = claims.UserID
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil {
msg, code := httpmsg.Error(err)