mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-06-23 19:11:35 +00:00
Added it and pl translations for password estimator, use lvenshtein distance and block partdb word
This commit is contained in:
parent
c3af73daae
commit
9127bcf25e
3 changed files with 25 additions and 1 deletions
|
|
@ -25,6 +25,8 @@ import * as zxcvbnEnPackage from '@zxcvbn-ts/language-en';
|
||||||
import * as zxcvbnDePackage from '@zxcvbn-ts/language-de';
|
import * as zxcvbnDePackage from '@zxcvbn-ts/language-de';
|
||||||
import * as zxcvbnFrPackage from '@zxcvbn-ts/language-fr';
|
import * as zxcvbnFrPackage from '@zxcvbn-ts/language-fr';
|
||||||
import * as zxcvbnJaPackage from '@zxcvbn-ts/language-ja';
|
import * as zxcvbnJaPackage from '@zxcvbn-ts/language-ja';
|
||||||
|
import * as zxcvbnItPackage from '@zxcvbn-ts/language-it';
|
||||||
|
import * as zxcvbnPlPackage from '@zxcvbn-ts/language-pl';
|
||||||
import {trans} from '../../translator.js';
|
import {trans} from '../../translator.js';
|
||||||
|
|
||||||
/* stimulusFetch: 'lazy' */
|
/* stimulusFetch: 'lazy' */
|
||||||
|
|
@ -45,6 +47,10 @@ export default class extends Controller {
|
||||||
return zxcvbnFrPackage.translations;
|
return zxcvbnFrPackage.translations;
|
||||||
} else if (locale.includes('ja')) {
|
} else if (locale.includes('ja')) {
|
||||||
return zxcvbnJaPackage.translations;
|
return zxcvbnJaPackage.translations;
|
||||||
|
} else if (locale.includes('it')) {
|
||||||
|
return zxcvbnItPackage.translations;
|
||||||
|
} else if (locale.includes('pl')) {
|
||||||
|
return zxcvbnPlPackage.translations;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fallback to english
|
//Fallback to english
|
||||||
|
|
@ -58,11 +64,14 @@ export default class extends Controller {
|
||||||
//Configure zxcvbn
|
//Configure zxcvbn
|
||||||
const options = {
|
const options = {
|
||||||
graphs: zxcvbnCommonPackage.adjacencyGraphs,
|
graphs: zxcvbnCommonPackage.adjacencyGraphs,
|
||||||
|
useLevenshtein: true,
|
||||||
dictionary: {
|
dictionary: {
|
||||||
...zxcvbnCommonPackage.dictionary,
|
...zxcvbnCommonPackage.dictionary,
|
||||||
// We could use the english dictionary here too, but it is very big. So we just use the common words
|
// We could use the english dictionary here too, but it is very big. So we just use the common words
|
||||||
...zxcvbnEnPackage.dictionary,
|
...zxcvbnEnPackage.dictionary,
|
||||||
...zxcvbnDePackage.dictionary,
|
...zxcvbnDePackage.dictionary,
|
||||||
|
|
||||||
|
"partdb": ['part-db', 'partdb', 'part_db', 'part-db-symfony', 'partdb-symfony', 'part_db_symfony'],
|
||||||
},
|
},
|
||||||
translations: this._getTranslations(),
|
translations: this._getTranslations(),
|
||||||
};
|
};
|
||||||
|
|
@ -79,7 +88,6 @@ export default class extends Controller {
|
||||||
|
|
||||||
//Estimate the password strength
|
//Estimate the password strength
|
||||||
const result = await this._zxcvbnFactory.checkAsync(password);
|
const result = await this._zxcvbnFactory.checkAsync(password);
|
||||||
console.log(result);
|
|
||||||
|
|
||||||
//Update the badge
|
//Update the badge
|
||||||
this.badgeTarget.parentElement.classList.remove("d-none");
|
this.badgeTarget.parentElement.classList.remove("d-none");
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@
|
||||||
"@zxcvbn-ts/language-en": "^4.1.1",
|
"@zxcvbn-ts/language-en": "^4.1.1",
|
||||||
"@zxcvbn-ts/language-fr": "^4.1.1",
|
"@zxcvbn-ts/language-fr": "^4.1.1",
|
||||||
"@zxcvbn-ts/language-ja": "^4.1.1",
|
"@zxcvbn-ts/language-ja": "^4.1.1",
|
||||||
|
"@zxcvbn-ts/language-it": "^4.1.1",
|
||||||
|
"@zxcvbn-ts/language-pl": "^4.1.1",
|
||||||
"attr-accept": "^2.2.5",
|
"attr-accept": "^2.2.5",
|
||||||
"barcode-detector": "^3.0.5",
|
"barcode-detector": "^3.0.5",
|
||||||
"bootbox": "^6.0.0",
|
"bootbox": "^6.0.0",
|
||||||
|
|
|
||||||
14
yarn.lock
14
yarn.lock
|
|
@ -2111,6 +2111,13 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
||||||
|
|
||||||
|
"@zxcvbn-ts/language-it@^4.1.1":
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-it/-/language-it-4.1.1.tgz#b6fda40099e85a4fc1c5d14d75c9de8a304dd061"
|
||||||
|
integrity sha512-YxKCBO1rKuCMPYRyOxfUZA+3ju8OO8W9Qx8h/vHrHvuGIavK7L+fgXTUrhjHU8M+zE0pQZxS4wOdfgLFZaP57w==
|
||||||
|
dependencies:
|
||||||
|
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
||||||
|
|
||||||
"@zxcvbn-ts/language-ja@^4.1.1":
|
"@zxcvbn-ts/language-ja@^4.1.1":
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-ja/-/language-ja-4.1.1.tgz#acd36abe4f6083dceda22771148d0948e0e421d9"
|
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-ja/-/language-ja-4.1.1.tgz#acd36abe4f6083dceda22771148d0948e0e421d9"
|
||||||
|
|
@ -2118,6 +2125,13 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
||||||
|
|
||||||
|
"@zxcvbn-ts/language-pl@^4.1.1":
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-pl/-/language-pl-4.1.1.tgz#627d4c365a69e3f78d3e2b6e9667d1b57b6cc1ff"
|
||||||
|
integrity sha512-hF6Qu9cyHx7sSEzNOQrJQntq8geoincsGvlOC0wkD43LnUVSTR49MKxdsifsemlQgtxR7aUKDgK/e/RFHOljoQ==
|
||||||
|
dependencies:
|
||||||
|
"@zxcvbn-ts/dictionary-compression" "^3.0.1"
|
||||||
|
|
||||||
acorn-import-phases@^1.0.3:
|
acorn-import-phases@^1.0.3:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7"
|
resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue