mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 08:55:50 +02:00
fix: #7472
This commit is contained in:
@@ -50,6 +50,7 @@ var scripts = [
|
|||||||
'public/vendor/xregexp/unicode/unicode-base.js',
|
'public/vendor/xregexp/unicode/unicode-base.js',
|
||||||
'public/src/utils.js',
|
'public/src/utils.js',
|
||||||
'public/src/installer/install.js',
|
'public/src/installer/install.js',
|
||||||
|
'node_modules/zxcvbn/dist/zxcvbn.js',
|
||||||
];
|
];
|
||||||
|
|
||||||
var installing = false;
|
var installing = false;
|
||||||
@@ -131,6 +132,7 @@ function welcome(req, res) {
|
|||||||
success: success,
|
success: success,
|
||||||
values: req.body,
|
values: req.body,
|
||||||
minimumPasswordLength: defaults.minimumPasswordLength,
|
minimumPasswordLength: defaults.minimumPasswordLength,
|
||||||
|
minimumPasswordStrength: defaults.minimumPasswordStrength,
|
||||||
installing: installing,
|
installing: installing,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/* global zxcvbn */
|
||||||
|
|
||||||
$('document').ready(function () {
|
$('document').ready(function () {
|
||||||
setupInputs();
|
setupInputs();
|
||||||
@@ -75,6 +76,9 @@ $('document').ready(function () {
|
|||||||
} else if (field.length < $('[name="admin:password"]').attr('data-minimum-length')) {
|
} else if (field.length < $('[name="admin:password"]').attr('data-minimum-length')) {
|
||||||
parent.addClass('error');
|
parent.addClass('error');
|
||||||
help.html('Password is too short.');
|
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 {
|
} else {
|
||||||
parent.removeClass('error');
|
parent.removeClass('error');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
<div class="row input-row">
|
<div class="row input-row">
|
||||||
<div class="col-sm-7 col-xs-12 input-field">
|
<div class="col-sm-7 col-xs-12 input-field">
|
||||||
<label for="admin:password">Password</label>
|
<label for="admin:password">Password</label>
|
||||||
<input type="password" class="form-control" name="admin:password" value="<!-- IF admin:password -->{admin:password}<!-- ENDIF admin:password -->" placeholder="Password" data-minimum-length="{minimumPasswordLength}" />
|
<input type="password" class="form-control" name="admin:password" value="<!-- IF admin:password -->{admin:password}<!-- ENDIF admin:password -->" placeholder="Password" data-minimum-strength="{minimumPasswordStrength}" data-minimum-length="{minimumPasswordLength}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-5 help-text" data-help="Use a combination of numbers, symbols, and different cases. You can change the strictness of password creation in the Admin Control Panel. Minimum {minimumPasswordLength} characters."></div>
|
<div class="col-sm-5 help-text" data-help="Use a combination of numbers, symbols, and different cases. You can change the strictness of password creation in the Admin Control Panel. Minimum {minimumPasswordLength} characters."></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user