fix: #8163, prevent account deletion

This commit is contained in:
Barış Soner Uşaklı
2020-02-13 11:31:20 -05:00
parent f4ed35c998
commit 4d0636f847
2 changed files with 15 additions and 0 deletions

View File

@@ -49,6 +49,9 @@ SocketUser.deleteAccount = async function (socket, data) {
if (isAdmin) {
throw new Error('[[error:cant-delete-admin]]');
}
if (meta.config.allowAccountDelete !== 1) {
throw new Error('[[error:no-privileges]]');
}
const userData = await user.deleteAccount(socket.uid);
require('./index').server.sockets.emit('event:user_status_change', { uid: socket.uid, status: 'offline' });