MCPcopy Create free account
hub / github.com/MertJSX/folderhost / UpdateUserPassword

Function UpdateUserPassword

database/users/update_user_password.go:10–31  ·  view source on GitHub ↗
(id int, newPassword string)

Source from the content-addressed store, hash-verified

8)
9
10func UpdateUserPassword(id int, newPassword string) error {
11 const query = `
12 UPDATE users SET
13 password = ?
14 WHERE id = ?;
15 `
16
17 hash, err := utils.Hash([]byte(newPassword))
18 if err != nil {
19 return err
20 }
21 defer clear(hash)
22
23 passwordHashString := hex.EncodeToString(hash[:])
24 _, err = database.DB.Exec(
25 query,
26 passwordHashString,
27 id,
28 )
29
30 return err
31}

Callers 2

ChangeUserPasswordFunction · 0.92
ChangeUserPasswordFunction · 0.85

Calls 1

HashFunction · 0.92

Tested by

no test coverage detected