fix profile update

This commit is contained in:
barisusakli
2015-02-05 23:37:11 -05:00
parent 652e247d1b
commit ba6af71150

View File

@@ -168,6 +168,7 @@ SocketUser.updateProfile = function(socket, data, callback) {
newUsername: userData.username
});
}
callback(null, userData);
}
if (socket.uid === parseInt(data.uid, 10)) {
@@ -175,12 +176,8 @@ SocketUser.updateProfile = function(socket, data, callback) {
}
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (err) {
return callback(err);
}
if (!isAdmin) {
return callback(new Error('[[error:no-privileges]]'));
if (err || !isAdmin) {
return callback(err || new Error('[[error:no-privileges]]'));
}
user.updateProfile(data.uid, data, done);