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

Function resetPassword

lib/auth/actions.js:126–138  ·  view source on GitHub ↗
(id, newPassword)

Source from the content-addressed store, hash-verified

124 * Reset a user's password.
125 */
126export async function resetPassword(id, newPassword) {
127 await requireAdmin();
128
129 if (!newPassword || newPassword.length < 8) {
130 return { error: 'Password must be at least 8 characters.' };
131 }
132
133 const updated = updateUserPasswordById(id, newPassword);
134 if (!updated) {
135 return { error: 'User not found.' };
136 }
137 return { success: true };
138}
139
140/**
141 * Update the current user's own profile info (first/last name, nickname).

Callers 1

handleSaveFunction · 0.90

Calls 2

requireAdminFunction · 0.90
updateUserPasswordByIdFunction · 0.90

Tested by

no test coverage detected