diff --git a/bin/lib/options.js b/bin/lib/options.js index 957d14eaa..44ae34a03 100644 --- a/bin/lib/options.js +++ b/bin/lib/options.js @@ -351,6 +351,14 @@ module.exports = [ validate: validUri, when: answers => answers.enforceToc }, + { + name: 'disable-password-checks', + help: 'Do you want to disable password strength checking?', + flag: true, + prompt: true, + default: false, + when: answers => answers.multiuser + }, { name: 'support-email', help: 'The support email you provide for your users (not required)', diff --git a/common/js/solid.js b/common/js/solid.js index cdc604930..850b0610a 100644 --- a/common/js/solid.js +++ b/common/js/solid.js @@ -45,6 +45,8 @@ PasswordValidator.prototype.fetchDomNodes = function () { this.form = this.passwordField.closest('form') + this.disablePasswordChecks = this.passwordField.classList.contains('disable-password-checks') + this.passwordGroup = this.passwordField.closest('.form-group') this.passwordFeedback = this.passwordGroup.querySelector('.form-control-feedback') this.passwordStrengthMeter = this.passwordGroup.querySelector('.progress-bar') @@ -69,8 +71,10 @@ this.errors = [] this.resetValidation(this.passwordGroup) this.resetFeedbackIcon(this.passwordFeedback) - this.displayPasswordErrors() - this.instantFeedbackForPassword() + if (!this.disablePasswordChecks) { + this.displayPasswordErrors() + this.instantFeedbackForPassword() + } } /** @@ -99,14 +103,17 @@ PasswordValidator.prototype.validatePassword = function () { this.errors = [] const password = this.passwordField.value - const passwordStrength = this.getPasswordStrength(password) - this.currentStrengthLevel = this.getStrengthLevel(passwordStrength) - if (passwordStrength.errors) { - this.addPasswordError(passwordStrength.errors) - } + if (!this.disablePasswordChecks) { + const passwordStrength = this.getPasswordStrength(password) + this.currentStrengthLevel = this.getStrengthLevel(passwordStrength) + + if (passwordStrength.errors) { + this.addPasswordError(passwordStrength.errors) + } - this.checkLeakedPassword(password).then(this.handleLeakedPasswordResponse.bind(this)) + this.checkLeakedPassword(password).then(this.handleLeakedPasswordResponse.bind(this)) + } this.setPasswordFeedback() } diff --git a/config.json-default b/config.json-default index 8b1f95736..08e8d5475 100644 --- a/config.json-default +++ b/config.json-default @@ -16,6 +16,7 @@ "logo": "" }, "enforceToc": true, + "disablePasswordChecks": false, "tocUri": "https://your-toc", "supportEmail": "Your support email address" } diff --git a/default-views/account/register-form.hbs b/default-views/account/register-form.hbs index 53714f2f0..63f51da04 100644 --- a/default-views/account/register-form.hbs +++ b/default-views/account/register-form.hbs @@ -36,7 +36,7 @@