v1.18.x
barisusakli 10 years ago
parent 2b0b2ea858
commit a31178ebd8

@ -7,8 +7,12 @@
"email": "Email",
"confirm_email": "Confirm Email",
"ban_account": "Ban Account",
"ban_account_confirm": "Do you really want to ban this user?",
"unban_account": "Unban Account",
"delete_account": "Delete Account",
"delete_account_confirm": "Are you sure you want to delete your account? <br /><strong>This action is irreversible and you will not be able to recover any of your data</strong><br /><br />Enter your username to confirm that you wish to destroy this account.",
"delete_this_account_confirm": "Are you sure you want to delete this account? <br /><strong>This action is irreversible and you will not be able to recover any data</strong><br /><br />",
"fullname": "Full Name",
"website": "Website",

@ -1,6 +1,6 @@
'use strict';
/* globals define, ajaxify, app, utils, socket */
/* globals define, ajaxify, app, utils, socket, bootbox */
define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll', 'translator'], function(header, infinitescroll, translator) {
var Account = {},
@ -33,6 +33,10 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
app.openChat($('.account-username').html(), theirid);
});
$('#banAccountBtn').on('click', banAccount);
$('#unbanAccountBtn').on('click', unbanAccount);
$('#deleteAccountBtn').on('click', deleteAccount);
socket.removeListener('event:user_status_change', onUserStatusChange);
socket.on('event:user_status_change', onUserStatusChange);
@ -112,5 +116,49 @@ define('forum/account/profile', ['forum/account/header', 'forum/infinitescroll',
});
}
function banAccount() {
translator.translate('[[user:ban_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.banUsers', [ajaxify.variables.get('theirid')], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', true);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', false);
});
});
});
}
function unbanAccount() {
socket.emit('admin.user.unbanUsers', [ajaxify.variables.get('theirid')], function(err) {
if (err) {
return app.alertError(err.message);
}
$('#banAccountBtn').toggleClass('hide', false);
$('#banLabel, #unbanAccountBtn').toggleClass('hide', true);
});
}
function deleteAccount() {
translator.translate('[[user:delete_this_account_confirm]]', function(translated) {
bootbox.confirm(translated, function(confirm) {
if (!confirm) {
return;
}
socket.emit('admin.user.deleteUsers', [ajaxify.variables.get('theirid')], function(err) {
if (err) {
return app.alertError(err.message);
}
history.back();
});
});
});
}
return Account;
});

@ -80,6 +80,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) {
userData.uid = userData.uid;
userData.yourid = callerUID;
userData.theirid = userData.uid;
userData.isAdmin = isAdmin;
userData.isSelf = self;
userData.showHidden = self || isAdmin;
userData.groups = Array.isArray(results.groups) && results.groups.length ? results.groups[0] : [];

Loading…
Cancel
Save