MCPcopy Create free account
hub / github.com/devinterface/startersaas-go-api / ChangePassword

Method ChangePassword

endpoints/user.endpoint.go:58–71  ·  view source on GitHub ↗

ChangePassword function

(ctx *fiber.Ctx)

Source from the content-addressed store, hash-verified

56
57// ChangePassword function
58func (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
74func (userEndpoint *UserEndpoint) GenerateSso(ctx *fiber.Ctx) error {

Callers

nothing calls this directly

Calls 3

ShowUserSerializerFunction · 0.92
CurrentUserMethod · 0.80
UpdatePasswordMethod · 0.80

Tested by

no test coverage detected