From cc3c3b07b27c147c7bc20b5d86d7ce4d8ca3c57d Mon Sep 17 00:00:00 2001 From: Urko Date: Fri, 7 Jul 2023 23:50:28 +0200 Subject: [PATCH] fiix body parser change to form value --- internal/api/handler/prosody_hdl.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/api/handler/prosody_hdl.go b/internal/api/handler/prosody_hdl.go index dfc0436..84e87d3 100644 --- a/internal/api/handler/prosody_hdl.go +++ b/internal/api/handler/prosody_hdl.go @@ -28,9 +28,10 @@ type changePasswordReq struct { } func (handler ProsodyHandler) Post(c *fiber.Ctx) error { - req := changePasswordReq{} - if err := c.BodyParser(&req); err != nil { - return RenderError(c, fmt.Errorf("id is empty"), defaultErrMessage) + req := changePasswordReq{ + CurrentPassword: c.FormValue("current_password", ""), + NewPassword: c.FormValue("new_password", ""), + User: c.FormValue("user", ""), } log.Println("req.User, req.CurrentPassword, req.NewPassword", req.User, req.CurrentPassword, req.NewPassword) if err := handler.prosodyService.ChangePassword(req.User, req.CurrentPassword, req.NewPassword); err != nil {