v1.18.x
barisusakli 10 years ago
parent d7444e5edf
commit 7632997a99

@ -66,6 +66,8 @@ app.cacheBuster = null;
}, 1000);
});
socket.on('event:logout', app.logout);
socket.on('event:alert', function(data) {
app.alert(data);
});

@ -157,8 +157,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader', 'translator'],
return false;
} else {
socket.emit('user.deleteAccount', {}, function(err) {
if (!err) {
app.logout();
if (err) {
app.alertError(err.message);
}
});
}

@ -115,6 +115,10 @@ var async = require('async'),
return next(err);
}
uids = uids.filter(function(uid) {
return uid && parseInt(uid, 10);
});
if (options.truncateUserList) {
var userListCount = parseInt(options.userListCount, 10) || 4;
if (uids.length > userListCount) {

@ -250,6 +250,12 @@ var db = require('./database'),
return callback(err);
}
results.users.forEach(function(user, index) {
if (user && !parseInt(user.uid, 10)) {
Messaging.markRead(uid, uids[index]);
}
});
results.users = results.users.filter(function(user) {
return user && parseInt(user.uid, 10);
});

@ -24,20 +24,27 @@ SocketUser.exists = function(socket, data, callback) {
};
SocketUser.deleteAccount = function(socket, data, callback) {
if (socket.uid) {
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (err || isAdmin) {
return callback(err || new Error('[[error:cant-delete-admin]]'));
}
if (!socket.uid) {
return;
}
user.isAdministrator(socket.uid, function(err, isAdmin) {
if (err || isAdmin) {
return callback(err || new Error('[[error:cant-delete-admin]]'));
}
socket.broadcast.emit('event:user_status_change', {uid: socket.uid, status: 'offline'});
user.deleteAccount(socket.uid, callback);
socket.broadcast.emit('event:user_status_change', {uid: socket.uid, status: 'offline'});
user.deleteAccount(socket.uid, function(err) {
if (err) {
return callback(err);
}
websockets.in('uid_' + socket.uid).emit('event:logout');
callback();
});
}
});
};
SocketUser.emailExists = function(socket, data, callback) {
if(data && data.email) {
if (data && data.email) {
user.email.exists(data.email, callback);
}
};

Loading…
Cancel
Save