Node.js based forum software built for the modern web
fixes #6415
Julian Lam9641ada53cc8
diff --git a/src/user/create.js b/src/user/create.jsindex 4352dd2d48..f2a9b87f55 100644--- a/src/user/create.js+++ b/src/user/create.js@@ -180,7 +180,12 @@ module.exports = function (User) {});};- User.isPasswordValid = function (password, callback) {+ User.isPasswordValid = function (password, minStrength, callback) {+ if (typeof minStrength === 'function' && !callback) {+ callback = minStrength;+ minStrength = meta.config.minimumPasswordStrength;+ }+// Sanity checks: Checks if defined and is stringif (!password || !utils.isPasswordValid(password)) {return callback(new Error('[[error:invalid-password]]'));@@ -195,7 +200,7 @@ module.exports = function (User) {}var strength = zxcvbn(password);- if (strength.score < meta.config.minimumPasswordStrength) {+ if (strength.score < minStrength) {return callback(new Error('[[user:weak_password]]'));}diff --git a/src/user/password.js b/src/user/password.jsindex 7c9e927275..d644fd2e8f 100644--- a/src/user/password.js+++ b/src/user/password.js@@ -28,7 +28,7 @@ module.exports = function (User) {return callback(null, true);}- User.isPasswordValid(password, next);+ User.isPasswordValid(password, 0, next);},function (next) {Password.compare(password, hashedPassword, next);