Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down
23 changes: 15 additions & 8 deletions common/js/solid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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()
}
}

/**
Expand Down Expand Up @@ -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()
}
Expand Down
1 change: 1 addition & 0 deletions config.json-default
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"logo": ""
},
"enforceToc": true,
"disablePasswordChecks": false,
"tocUri": "https://your-toc",
"supportEmail": "Your support email address"
}
2 changes: 1 addition & 1 deletion default-views/account/register-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

<div class="form-group has-feedback">
<label class="control-label" for="password">Password*</label>
<input type="password" class="form-control control-progress" name="password" id="password" required/>
<input type="password" class="form-control control-progress{{#if disablePasswordStrengthCheck}} disable-password-strength-check{{/if}}" name="password" id="password" required/>
<span class="glyphicon glyphicon-remove form-control-feedback hidden" aria-hidden="true"></span>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="4"></div>
Expand Down
1 change: 1 addition & 0 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion lib/requests/create-account-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CreateAccountRequest extends AuthRequest {
this.username = options.username
this.userAccount = options.userAccount
this.acceptToc = options.acceptToc
this.disablePasswordChecks = options.disablePasswordChecks
}

/**
Expand Down Expand Up @@ -69,6 +70,7 @@ class CreateAccountRequest extends AuthRequest {

options.enforceToc = locals.enforceToc
options.tocUri = locals.tocUri
options.disablePasswordChecks = locals.disablePasswordChecks

switch (authMethod) {
case 'oidc':
Expand Down Expand Up @@ -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) {
Expand Down