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 @@
- +
diff --git a/lib/create-app.js b/lib/create-app.js index 1a6476ac4..167c8f0cb 100644 --- a/lib/create-app.js +++ b/lib/create-app.js @@ -137,6 +137,7 @@ function initAppLocals (app, argv, ldp) { app.locals.tokenService = new TokenService() app.locals.enforceToc = argv.enforceToc app.locals.tocUri = argv.tocUri + app.locals.disablePasswordChecks = argv.disablePasswordChecks if (argv.email && argv.email.host) { app.locals.emailService = new EmailService(argv.templates.email, argv.email) diff --git a/lib/requests/create-account-request.js b/lib/requests/create-account-request.js index a130e7139..d8c4aa23e 100644 --- a/lib/requests/create-account-request.js +++ b/lib/requests/create-account-request.js @@ -38,6 +38,7 @@ class CreateAccountRequest extends AuthRequest { this.username = options.username this.userAccount = options.userAccount this.acceptToc = options.acceptToc + this.disablePasswordChecks = options.disablePasswordChecks } /** @@ -69,6 +70,7 @@ class CreateAccountRequest extends AuthRequest { options.enforceToc = locals.enforceToc options.tocUri = locals.tocUri + options.disablePasswordChecks = locals.disablePasswordChecks switch (authMethod) { case 'oidc': @@ -113,7 +115,8 @@ class CreateAccountRequest extends AuthRequest { multiuser: this.accountManager.multiuser, registerDisabled: authMethod === 'tls', returnToUrl: this.returnToUrl, - tocUri: this.tocUri + tocUri: this.tocUri, + disablePasswordChecks: this.disablePasswordChecks }) if (error) {