mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-01 00:58:53 +02:00
dont crash if data.username is undefined, dont set username to empty value
This commit is contained in:
@@ -57,6 +57,9 @@ module.exports = function(User) {
|
||||
}
|
||||
|
||||
function isUsernameAvailable(next) {
|
||||
if (!data.username) {
|
||||
return next();
|
||||
}
|
||||
User.getUserFields(uid, ['username', 'userslug'], function(err, userData) {
|
||||
|
||||
var userslug = utils.slugify(data.username);
|
||||
@@ -177,6 +180,9 @@ module.exports = function(User) {
|
||||
}
|
||||
|
||||
function updateUsername(uid, newUsername, callback) {
|
||||
if (!newUsername) {
|
||||
return callback();
|
||||
}
|
||||
User.getUserFields(uid, ['username', 'userslug'], function(err, userData) {
|
||||
function update(field, object, value, callback) {
|
||||
async.parallel([
|
||||
|
||||
Reference in New Issue
Block a user