MCPcopy Index your code
hub / github.com/aiprodcoder/MIXAPI / checkUpdatePassword

Function checkUpdatePassword

controller/user.go:551–566  ·  view source on GitHub ↗
(originalPassword string, newPassword string, userId int)

Source from the content-addressed store, hash-verified

549}
550
551func checkUpdatePassword(originalPassword string, newPassword string, userId int) (updatePassword bool, err error) {
552 var currentUser *model.User
553 currentUser, err = model.GetUserById(userId, true)
554 if err != nil {
555 return
556 }
557 if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) {
558 err = fmt.Errorf("原密码错误")
559 return
560 }
561 if newPassword == "" {
562 return
563 }
564 updatePassword = true
565 return
566}
567
568func DeleteUser(c *gin.Context) {
569 id, err := strconv.Atoi(c.Param("id"))

Callers 1

UpdateSelfFunction · 0.85

Calls 2

GetUserByIdFunction · 0.92
ValidatePasswordAndHashFunction · 0.92

Tested by

no test coverage detected