diff --git a/frontend/package.json b/frontend/package.json index ff4e63f68..32a1f2099 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,7 +27,7 @@ "@vector-im/compound-design-tokens": "10.2.0", "@vector-im/compound-web": "^9.3.0", "@zxcvbn-ts/core": "^4.1.2", - "@zxcvbn-ts/language-common": "^3.0.4", + "@zxcvbn-ts/language-common": "^4.1.2", "classnames": "^2.5.1", "date-fns": "^4.4.0", "i18next": "^26.3.1", diff --git a/frontend/src/utils/password_complexity/index.ts b/frontend/src/utils/password_complexity/index.ts index 1cb25c60c..143c170c6 100644 --- a/frontend/src/utils/password_complexity/index.ts +++ b/frontend/src/utils/password_complexity/index.ts @@ -1,10 +1,11 @@ +// Copyright 2026 Element Creations Ltd. // Copyright 2024, 2025 New Vector Ltd. // Copyright 2024 The Matrix.org Foundation C.I.C. // // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial // Please see LICENSE files in the repository root for full details. -import { zxcvbnAsync, zxcvbnOptions } from "@zxcvbn-ts/core"; +import { ZxcvbnFactory } from "@zxcvbn-ts/core"; import * as zxcvbnCommonPackage from "@zxcvbn-ts/language-common"; import type { TFunction } from "i18next"; @@ -54,7 +55,7 @@ const options = { l33tTable, }; -zxcvbnOptions.setOptions(options); +const zxcvbn = new ZxcvbnFactory(options); export interface PasswordComplexity { /** Score between 0 and 4 */ @@ -72,7 +73,7 @@ export async function estimatePasswordComplexity( password: string, t: TFunction, ): Promise { - const scorerResult = await zxcvbnAsync(password); + const scorerResult = await zxcvbn.checkAsync(password); const improvementsText = []; if (scorerResult.feedback.warning !== null) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfdb9740d..0cddc2daf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,8 +54,8 @@ importers: specifier: ^4.1.2 version: 4.1.2 '@zxcvbn-ts/language-common': - specifier: ^3.0.4 - version: 3.0.4 + specifier: ^4.1.2 + version: 4.1.2 classnames: specifier: ^2.5.1 version: 2.5.1 @@ -2630,8 +2630,11 @@ packages: '@zxcvbn-ts/core@4.1.2': resolution: {integrity: sha512-RQmxWB3AMI+HGQErQdUv6Aq32aQhp6xOxrfgCP0+T9MsLZoP3xtLHuT8O8VojsUxdmQVZfJlYkYb1A0wOwIS+Q==} - '@zxcvbn-ts/language-common@3.0.4': - resolution: {integrity: sha512-viSNNnRYtc7ULXzxrQIVUNwHAPSXRtoIwy/Tq4XQQdIknBzw4vz36lQLF6mvhMlTIlpjoN/Z1GFu/fwiAlUSsw==} + '@zxcvbn-ts/dictionary-compression@3.0.1': + resolution: {integrity: sha512-p3KyPzxGc3vWSap5hHA6SllbUCmh7s+NtpGyC3qEWrxYJT9t9TUAzjPm48Okipo+UUyPQfDlIvTcs9JRShBFiQ==} + + '@zxcvbn-ts/language-common@4.1.2': + resolution: {integrity: sha512-uJlBzhC9/KjPImqdnc1/lPxmdn4xKbkruN5p1mASWkXA0gli+GZ5LrVL+dqscA8Pcf4OfudE56TtCWeHljJOvA==} acorn@8.17.0: resolution: {integrity: sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==} @@ -6872,7 +6875,11 @@ snapshots: dependencies: fastest-levenshtein: 1.0.16 - '@zxcvbn-ts/language-common@3.0.4': {} + '@zxcvbn-ts/dictionary-compression@3.0.1': {} + + '@zxcvbn-ts/language-common@4.1.2': + dependencies: + '@zxcvbn-ts/dictionary-compression': 3.0.1 acorn@8.17.0: {}