auth: Make min password length and strength configurable.

This adds some configuration options to settings.py, namely
PASSWORD_MIN_LENGTH and PASSWORD_MIN_QUALITY, which control
when the frontend validator invalidates the password.

Closes #2628
This commit is contained in:
Bojidar Marinov
2017-01-09 19:04:23 +02:00
committed by showell
parent e6c3aaae12
commit 786dd0fca4
10 changed files with 48 additions and 23 deletions

View File

@@ -211,7 +211,8 @@ function _setup_page() {
});
$('#new_password').on('change keyup', function () {
password_quality($('#new_password').val(), $('#pw_strength .bar'));
var field = $('#new_password');
password_quality(field.val(), $('#pw_strength .bar'), field);
});
if (!page_params.show_digest_email) {
@@ -241,9 +242,10 @@ function _setup_page() {
if (page_params.password_auth_enabled !== false) {
// FIXME: Check that the two password fields match
// FIXME: Use the same jQuery validation plugin as the signup form?
var field = $('#new_password');
var new_pw = $('#new_password').val();
if (new_pw !== '') {
var password_ok = password_quality(new_pw);
var password_ok = password_quality(new_pw, undefined, field);
if (password_ok === undefined) {
// zxcvbn.js didn't load, for whatever reason.
settings_change_error(