ChangePassword function
(ctx *fiber.Ctx)
| 56 | |
| 57 | // ChangePassword function |
| 58 | func (userEndpoint *UserEndpoint) ChangePassword(ctx *fiber.Ctx) error { |
| 59 | me, _ := userEndpoint.CurrentUser(ctx) |
| 60 | var inputMap = make(map[string]interface{}) |
| 61 | ctx.BodyParser(&inputMap) |
| 62 | v := validate.Map(inputMap) |
| 63 | v.StringRule("password", "ascii|required") |
| 64 | |
| 65 | if !v.Validate() { |
| 66 | return ctx.Status(422).JSON(v.Errors) |
| 67 | } |
| 68 | updatedUser, _ := userService.UpdatePassword(me.GetID(), inputMap["password"].(string)) |
| 69 | showUser := models.ShowUserSerializer().Transform(updatedUser) |
| 70 | return ctx.JSON(showUser) |
| 71 | } |
| 72 | |
| 73 | // GenerateSso function |
| 74 | func (userEndpoint *UserEndpoint) GenerateSso(ctx *fiber.Ctx) error { |
nothing calls this directly
no test coverage detected