Merge pull request #1978 from merlinthp/chpass_callback
Add missing execution of callback in ClientManager.updateUser
This commit is contained in:
commit
42199eda29
@ -136,6 +136,9 @@ ClientManager.prototype.updateUser = function(name, opts, callback) {
|
|||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
log.error(`Tried to update invalid user ${colors.green(name)}. This is most likely a bug.`);
|
log.error(`Tried to update invalid user ${colors.green(name)}. This is most likely a bug.`);
|
||||||
|
if (callback) {
|
||||||
|
callback(true);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,8 +153,12 @@ ClientManager.prototype.updateUser = function(name, opts, callback) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
fs.writeFileSync(Helper.getUserConfigPath(name), newUser);
|
fs.writeFileSync(Helper.getUserConfigPath(name), newUser);
|
||||||
|
return callback ? callback() : true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error(`Failed to update user ${colors.green(name)} (${e})`);
|
log.error(`Failed to update user ${colors.green(name)} (${e})`);
|
||||||
|
if (callback) {
|
||||||
|
callback(e);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user