Replace zxcvbn by zxcvbn-ts

Signed-off-by: Gwénola ETHEVE <git@etheve.eu>

Update package.json

Co-authored-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Guileas 2021-06-23 23:49:24 +02:00
parent 0539194b48
commit 135b116f2f
No known key found for this signature in database
GPG Key ID: 9A2C6B9BA681AA28
11 changed files with 2159 additions and 70 deletions

View File

@ -6,7 +6,7 @@
/* global Indexes */ // js/indexes.js
/* global firstDayOfCalendar, maxInputVars, mysqlDocTemplate, themeImagePath */ // templates/javascript/variables.twig
/* global sprintf */ // js/vendor/sprintf.js
/* global zxcvbn */ // js/vendor/zxcvbn.js
/* global zxcvbnts */ // js/vendor/zxcvbn-ts.js
/**
* general function, usually for data manipulation pages
@ -518,7 +518,9 @@ Functions.checkPasswordStrength = function (value, meterObject, meterObjectLabel
if (username !== null) {
customDict.push(username);
}
var zxcvbnObject = zxcvbn(value, customDict);
zxcvbnts.core.ZxcvbnOptions.setOptions({ dictionary: { userInputs: customDict } });
var zxcvbnObject = zxcvbnts.core.zxcvbn(value);
var strength = zxcvbnObject.score;
strength = parseInt(strength);
meterObject.val(strength);

2141
js/vendor/zxcvbn-ts.js vendored Normal file

File diff suppressed because it is too large Load Diff

1
js/vendor/zxcvbn-ts.js.map vendored Normal file

File diff suppressed because one or more lines are too long

28
js/vendor/zxcvbn.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@ class PrivilegesController extends AbstractController
$cfgRelation = $this->relation->getRelationsParam();
$this->addScriptFiles(['server/privileges.js', 'vendor/zxcvbn.js']);
$this->addScriptFiles(['server/privileges.js', 'vendor/zxcvbn-ts.js']);
$relationCleanup = new RelationCleanup($this->dbi, $this->relation);
$serverPrivileges = new Privileges(

View File

@ -61,7 +61,7 @@ class ReplicationController extends AbstractController
$primaryInfo = $replicationInfo->getPrimaryInfo();
$replicaInfo = $replicationInfo->getReplicaInfo();
$this->addScriptFiles(['server/privileges.js', 'replication.js', 'vendor/zxcvbn.js']);
$this->addScriptFiles(['server/privileges.js', 'replication.js', 'vendor/zxcvbn-ts.js']);
if (isset($params['url_params']) && is_array($params['url_params'])) {
$urlParams = $params['url_params'];

View File

@ -39,7 +39,7 @@ class UserPasswordController extends AbstractController
{
global $cfg, $hostname, $username, $password, $change_password_message, $msg;
$this->addScriptFiles(['server/privileges.js', 'vendor/zxcvbn.js']);
$this->addScriptFiles(['server/privileges.js', 'vendor/zxcvbn-ts.js']);
/**
* Displays an error message and exits if the user isn't allowed to use this

View File

@ -14,6 +14,7 @@
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@popperjs/core": "^2.9.2",
"@zxcvbn-ts/core": "^1.0.0-beta.0",
"autoprefixer": "^10.2.6",
"bootstrap": "5.0.2",
"codemirror": "5.62.0",
@ -37,8 +38,7 @@
"tablesorter": "^2.31.3",
"tracekit": "0.4.6",
"u2f-api-polyfill": "0.4.4",
"updated-jqplot": "1.0.9",
"zxcvbn": "4.4.2"
"updated-jqplot": "1.0.9"
},
"devDependencies": {
"babel-jest": "^26.6.3",

View File

@ -48,9 +48,9 @@ cp ./node_modules/js-cookie/src/js.cookie.js ./js/vendor/js.cookie.js
echo 'Updating bootstrap'
cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js ./js/vendor/bootstrap/bootstrap.bundle.min.js
cp ./node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map ./js/vendor/bootstrap/bootstrap.bundle.min.js.map
echo 'Updating zxcvbn'
cp ./node_modules/zxcvbn/dist/zxcvbn.js ./js/vendor/zxcvbn.js
cp ./node_modules/zxcvbn/dist/zxcvbn.js.map ./js/vendor/zxcvbn.js.map
echo 'Updating zxcvbn-ts'
cp ./node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js ./js/vendor/zxcvbn-ts.js
cp ./node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js.map ./js/vendor/zxcvbn-ts.js.map
echo 'Updating tracekit'
cp ./node_modules/tracekit/tracekit.js ./js/vendor/tracekit.js
echo 'Updating u2f-api-polyfill'

View File

@ -1346,6 +1346,11 @@
dependencies:
"@types/yargs-parser" "*"
"@zxcvbn-ts/core@^1.0.0-beta.0":
version "1.0.0-beta.0"
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/core/-/core-1.0.0-beta.0.tgz#a616beacb83dbfe9174408ebabee746f3468b0ec"
integrity sha512-E2rHy2jrCDzJ62xqY5KteOHR+y7uPqL6FLUPVCDZmeYrAZRgB+CpO0QIQKLVrxwssx0YhApmE23eHmouce+OUA==
abab@^2.0.3, abab@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"
@ -6083,8 +6088,3 @@ zwitch@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920"
integrity sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==
zxcvbn@4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/zxcvbn/-/zxcvbn-4.4.2.tgz#28ec17cf09743edcab056ddd8b1b06262cc73c30"
integrity sha1-KOwXzwl0PtyrBW3dixsGJizHPDA=