From 962b7f73d301058c7dbee5d8a91fbf53ea6ca5fc Mon Sep 17 00:00:00 2001 From: Andrew Rodrigues Date: Tue, 19 Mar 2019 14:01:31 -0400 Subject: [PATCH] fix: #7472 --- install/web.js | 2 ++ public/src/installer/install.js | 4 ++++ src/views/install/index.tpl | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/install/web.js b/install/web.js index 097d3eb9b6..ed87011440 100644 --- a/install/web.js +++ b/install/web.js @@ -50,6 +50,7 @@ var scripts = [ 'public/vendor/xregexp/unicode/unicode-base.js', 'public/src/utils.js', 'public/src/installer/install.js', + 'node_modules/zxcvbn/dist/zxcvbn.js', ]; var installing = false; @@ -131,6 +132,7 @@ function welcome(req, res) { success: success, values: req.body, minimumPasswordLength: defaults.minimumPasswordLength, + minimumPasswordStrength: defaults.minimumPasswordStrength, installing: installing, }); } diff --git a/public/src/installer/install.js b/public/src/installer/install.js index 6c912f00ac..ba8efa7261 100644 --- a/public/src/installer/install.js +++ b/public/src/installer/install.js @@ -1,5 +1,6 @@ 'use strict'; +/* global zxcvbn */ $('document').ready(function () { setupInputs(); @@ -75,6 +76,9 @@ $('document').ready(function () { } else if (field.length < $('[name="admin:password"]').attr('data-minimum-length')) { parent.addClass('error'); help.html('Password is too short.'); + } else if (zxcvbn(field).score < parseInt($('[name="admin:password"]').attr('data-minimum-strength'), 10)) { + parent.addClass('error'); + help.html('Password is too weak.'); } else { parent.removeClass('error'); } diff --git a/src/views/install/index.tpl b/src/views/install/index.tpl index 4f2f87cf46..aab7d7e253 100644 --- a/src/views/install/index.tpl +++ b/src/views/install/index.tpl @@ -72,7 +72,7 @@
- +