Skip to main content

resetUserPassword()

resetUserPassword(userId: string, newPassword: string): Promise<UserSimpleResponse>

Defined in: packages/core/src/index.ts:612

Reset a user's password (admin only)

Parameters

ParameterTypeDescription
userIdstringThe unique identifier of the user
newPasswordstringThe new password to set

Returns

Promise<UserSimpleResponse>

Confirmation of password reset

Throws

400 - Password does not meet requirements

Throws

401 - Not authenticated

Throws

403 - Admin privileges required

Throws

404 - User not found

Example

import { resetUserPassword } from "@cpod/sdk";

const result = await resetUserPassword("user-123", "newSecurePassword456");
console.log(result.message); // "Password reset successfully"