MCPcopy
hub / github.com/stephengpope/thepopebot / updateUserPasswordById

Function updateUserPasswordById

lib/db/users.js:191–199  ·  view source on GitHub ↗
(id, newPassword)

Source from the content-addressed store, hash-verified

189 * @returns {boolean} True if updated
190 */
191export function updateUserPasswordById(id, newPassword) {
192 const db = getDb();
193 const passwordHash = hashSync(newPassword, genSaltSync(10));
194 const result = db.update(users)
195 .set({ passwordHash, updatedAt: Date.now() })
196 .where(eq(users.id, id))
197 .run();
198 return result.changes > 0;
199}
200
201/**
202 * Verify a password against a user's stored hash.

Callers 2

resetPasswordFunction · 0.90
updateProfileFunction · 0.90

Calls 1

getDbFunction · 0.90

Tested by

no test coverage detected