Skip to main content
Back to Browser

evaluateChangePasswordForm()

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.newPasswordstringThe value to set.
values.confirmPasswordstringThe re-typed value, used only to catch typos client-side.
policyPasswordPolicyThe 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

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.