fiix body parser change to form value

This commit is contained in:
Urko 2023-07-07 23:50:28 +02:00
parent 3080b94640
commit cc3c3b07b2
1 changed files with 4 additions and 3 deletions

View File

@ -28,9 +28,10 @@ type changePasswordReq struct {
} }
func (handler ProsodyHandler) Post(c *fiber.Ctx) error { func (handler ProsodyHandler) Post(c *fiber.Ctx) error {
req := changePasswordReq{} req := changePasswordReq{
if err := c.BodyParser(&req); err != nil { CurrentPassword: c.FormValue("current_password", ""),
return RenderError(c, fmt.Errorf("id is empty"), defaultErrMessage) NewPassword: c.FormValue("new_password", ""),
User: c.FormValue("user", ""),
} }
log.Println("req.User, req.CurrentPassword, req.NewPassword", req.User, req.CurrentPassword, req.NewPassword) 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 { if err := handler.prosodyService.ChangePassword(req.User, req.CurrentPassword, req.NewPassword); err != nil {