mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-06 10:06:31 +02:00
closes #3607
This commit is contained in:
@@ -157,7 +157,7 @@ module.exports = function(User) {
|
||||
},
|
||||
passwordValid: function(next) {
|
||||
if (userData.password) {
|
||||
next(!utils.isPasswordValid(userData.password) ? new Error('[[error:invalid-password]]') : null);
|
||||
User.isPasswordValid(userData.password, next);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
@@ -179,6 +179,17 @@ module.exports = function(User) {
|
||||
});
|
||||
};
|
||||
|
||||
User.isPasswordValid = function(password, callback) {
|
||||
if (!password || !utils.isPasswordValid(password)) {
|
||||
return callback(new Error('[[error:invalid-password]]'));
|
||||
}
|
||||
|
||||
if (password.length < meta.config.minimumPasswordLength) {
|
||||
return callback(new Error('[[user:change_password_error_length]]'));
|
||||
}
|
||||
callback();
|
||||
};
|
||||
|
||||
function renameUsername(userData, callback) {
|
||||
meta.userOrGroupExists(userData.userslug, function(err, exists) {
|
||||
if (err || !exists) {
|
||||
|
||||
Reference in New Issue
Block a user