MCPcopy Create free account
hub / github.com/TalkingData/owl / resetUserPassword

Function resetUserPassword

api/users.go:172–192  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

170}
171
172func resetUserPassword(c *gin.Context) {
173 response := gin.H{"code": http.StatusOK}
174 defer c.JSON(http.StatusOK, response)
175 var user *User
176 if err := c.BindJSON(&user); err != nil {
177 response["code"] = http.StatusBadRequest
178 log.Println(err)
179 return
180 }
181 username := user.Username
182 if user = mydb.getUserProfile(username); user == nil {
183 response["code"] = http.StatusBadRequest
184 return
185 }
186 user.Password = utils.Md5(user.Username)
187 if err := mydb.updateUserProfile(user); err != nil {
188 response["code"] = http.StatusInternalServerError
189 return
190 }
191 response["user"] = user
192}
193
194func updateUserProfile(c *gin.Context) {
195 response := gin.H{"code": http.StatusOK}

Callers

nothing calls this directly

Calls 2

getUserProfileMethod · 0.80
updateUserProfileMethod · 0.80

Tested by

no test coverage detected