forked from ebhomengo/niki
🔒fix(delivery): fixed the security problem of the create benefactor kinfboxreq
This commit is contained in:
parent
d829192bd6
commit
aa129a870e
|
@ -10,11 +10,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h Handler) Add(c echo.Context) error {
|
func (h Handler) Add(c echo.Context) error {
|
||||||
claims := claim.GetClaimsFromEchoContext(c)
|
req := param.KindBoxReqAddRequest{}
|
||||||
req := param.KindBoxReqAddRequest{BenefactorID: claims.UserID}
|
|
||||||
if bErr := c.Bind(&req); bErr != nil {
|
if bErr := c.Bind(&req); bErr != nil {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest)
|
return echo.NewHTTPError(http.StatusBadRequest)
|
||||||
}
|
}
|
||||||
|
claims := claim.GetClaimsFromEchoContext(c)
|
||||||
|
req.BenefactorID = claims.UserID
|
||||||
|
|
||||||
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil {
|
if fieldErrors, err := h.benefactorKindBoxReqVld.ValidateAddRequest(req); err != nil {
|
||||||
msg, code := httpmsg.Error(err)
|
msg, code := httpmsg.Error(err)
|
||||||
|
|
Loading…
Reference in New Issue