From f8e555dac5451d338be42966835f33355af08a2b Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 9 Mar 2021 17:54:07 +0530 Subject: [PATCH] Fix incorrect ID handling in update handlers --- cmd/subscribers.go | 2 +- cmd/templates.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/subscribers.go b/cmd/subscribers.go index 42f86e3..de9eb62 100644 --- a/cmd/subscribers.go +++ b/cmd/subscribers.go @@ -310,7 +310,7 @@ func handleUpdateSubscriber(c echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("subscribers.invalidName")) } - _, err := app.queries.UpdateSubscriber.Exec(req.ID, + _, err := app.queries.UpdateSubscriber.Exec(id, strings.ToLower(strings.TrimSpace(req.Email)), strings.TrimSpace(req.Name), req.Status, diff --git a/cmd/templates.go b/cmd/templates.go index 6977b9a..637989f 100644 --- a/cmd/templates.go +++ b/cmd/templates.go @@ -177,8 +177,7 @@ func handleUpdateTemplate(c echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, err.Error()) } - // TODO: PASSWORD HASHING. - res, err := app.queries.UpdateTemplate.Exec(o.ID, o.Name, o.Body) + res, err := app.queries.UpdateTemplate.Exec(id, o.Name, o.Body) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, app.i18n.Ts("globals.messages.errorUpdating",