Skip to main content

updatePassword

Update a customer's password with security validation and hashing.

Import​

import { updatePassword } from "@evershop/evershop/customer/services";

Syntax​

updatePassword(customerId: number, newPassword: string, context?: Record<string, unknown>): Promise<boolean>

Parameters​

customerId

Type: number

Customer ID (not UUID).

newPassword

Type: string

New password in plain text.

context (optional)

Type: Record<string, unknown>

Additional context for hooks.

Return Value​

Returns Promise<boolean> - true on success.

Examples​

Basic Password Update​

import { updatePassword } from "@evershop/evershop/customer/services";

await updatePassword(123, 'NewSecurePass123!');
console.log('Password updated successfully');

Hooks​

Supports hooks via registry:

  • updateCustomerPassword - Hook password update

See Also​