TypeScript API / @laikacms/server/oauth2 / resetPassword
Function: resetPassword()
ts
function resetPassword(
token,
newPassword,
config
): Promise<{
error?: string;
success: boolean;
userId?: string;
}>;Reset a user's password using a valid reset token.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | The reset token from the email link |
newPassword | string | The new password to set |
config | PasswordResetConfig | Password reset configuration |
Returns
Promise<{ error?: string; success: boolean; userId?: string; }>
Result indicating success or failure
Example
typescript
import { resetPassword } from '@laikacms/server/oauth2';
import { hashPassword } from '@laikacms/server/oauth2';
const result = await resetPassword(
'abc123token',
'newSecurePassword123',
config,
hashPassword
);
if (result.success) {
console.log('Password reset successfully');
}