This commit is contained in:
barisusakli
2014-09-24 00:07:24 -04:00
parent 23197af725
commit bedadd8b5f
2 changed files with 8 additions and 13 deletions

View File

@@ -22,7 +22,12 @@ SocketUser.exists = function(socket, data, callback) {
SocketUser.deleteAccount = function(socket, data, callback) {
if (socket.uid) {
user.deleteAccount(socket.uid, callback);
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (err || isAdmin) {
return callback(err || new Error('[[error:cant-delete-admin]]'));
}
user.deleteAccount(socket.uid, callback);
});
}
};