Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions EssentialCSharp.Web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion EssentialCSharp.Web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@mdi/font": "7.4.47",
"@zxcvbn-ts/core": "^3.0.4",
"@zxcvbn-ts/core": "^4.1.2",
"@zxcvbn-ts/language-common": "^4.1.3",
"@zxcvbn-ts/language-en": "^4.1.1",
"dompurify": "3.4.13",
Expand Down
7 changes: 4 additions & 3 deletions EssentialCSharp.Web/wwwroot/js/password-strength.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* data-min-length — Minimum password length enforced server-side (from PasswordRequirementOptions)
*/

import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core';
import { ZxcvbnFactory } from '@zxcvbn-ts/core';

const SCORE_CONFIG = [
{ label: 'Very weak', barClass: 'bg-danger', width: 20 },
Expand All @@ -21,6 +21,7 @@ const SCORE_CONFIG = [

let zxcvbnReady = false;
let zxcvbnLoadPromise = null;
let zxcvbn = null;

async function ensureZxcvbn() {
if (zxcvbnReady) return;
Expand All @@ -32,7 +33,7 @@ async function ensureZxcvbn() {
}
try {
const [zxcvbnCommon, zxcvbnEn] = await zxcvbnLoadPromise;
zxcvbnOptions.setOptions({
zxcvbn = new ZxcvbnFactory({
translations: zxcvbnEn.translations,
graphs: zxcvbnCommon.adjacencyGraphs,
dictionary: { ...zxcvbnCommon.dictionary, ...zxcvbnEn.dictionary },
Expand Down Expand Up @@ -281,7 +282,7 @@ function initMeter(container) {
// Guard against stale result if the user kept typing during the initial load
if (password !== passwordInput.value) return;
const userInputs = getUserInputValues(userInputFieldIds);
const result = zxcvbn(password, userInputs);
const result = zxcvbn.check(password, userInputs);

// Render zxcvbn result immediately; HIBP check runs asynchronously below.
if (hibpWarningActive) {
Expand Down