(id, newPassword)
| 124 | * Reset a user's password. |
| 125 | */ |
| 126 | export 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). |
no test coverage detected