Skip to main content

`evaluateChangePasswordForm()`

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

evaluateChangePasswordForm evaluates a full change-credential form (new value + confirmation) against a policy in one call, so a live requirement checklist and a submit gate can never disagree about what counts as valid. This is what <ChangeCredential /> uses internally in the React and Vue SDKs.

Signature​

evaluateChangePasswordForm(
values: ChangePasswordFormValues,
policy: PasswordPolicy,
): ChangePasswordFormEvaluation

Parameters​

ParameterTypeRequiredDescription
values.newPasswordstring✅The value to set.
values.confirmPasswordstring✅The re-typed value, used only to catch typos client-side.
policyPasswordPolicy✅The rules newPassword must satisfy. See resolveChangeCredentialPolicy().

There is deliberately no currentPassword field. The self-service credential write path does not verify the account's existing value today, so a field the server ignores would only teach the user a false sense of security.

Returns​

ChangePasswordFormEvaluation

PropertyTypeDescription
confirmMatchesbooleanWhether newPassword and confirmPassword match.
isValidbooleanWhether the values are complete and internally consistent. Combine with your own in-flight flag, since a pending request is UI state rather than validation.
meetsPolicybooleanWhether newPassword satisfies every configured rule.
ruleResultsPasswordRuleResult[]Per-rule results, for the live requirement checklist.

Usage​

import { evaluateChangePasswordForm } from '@thunderid/browser'

const { isValid, ruleResults } = evaluateChangePasswordForm(
{ newPassword, confirmPassword },
{ regex: '^.{12,}$' },
)
const canSubmit = !loading && isValid

Was this page helpful?