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

Method UpdatePassword

services/user.service.go:91–101  ·  view source on GitHub ↗

UpdatePassword function

(id interface{}, password string)

Source from the content-addressed store, hash-verified

89
90// UpdatePassword function
91func (userService *UserService) UpdatePassword(id interface{}, password string) (updatedUser *models.User, err error) {
92 user := &models.User{}
93 err = userService.getCollection().FindByID(id, user)
94 if err != nil {
95 return user, err
96 }
97 hash, _ := hashPassword(password)
98 user.Password = hash
99 err = userService.getCollection().Update(user)
100 return user, err
101}
102
103// FindBy function
104func (userService *UserService) FindBy(q bson.M) (users []models.User, err error) {

Callers 1

ChangePasswordMethod · 0.80

Calls 3

getCollectionMethod · 0.95
hashPasswordFunction · 0.85
UpdateMethod · 0.45

Tested by

no test coverage detected