Added the possibility to remove a user's data when deleting a user.

This commit is contained in:
chateau 2018-12-16 22:32:29 +01:00
parent c0b7e55350
commit 7c9916d936
3 changed files with 33 additions and 4 deletions

View file

@ -269,6 +269,9 @@ button {
.content {
.modal-body;
.warning {
color: red;
}
}
footer {

View file

@ -196,19 +196,43 @@
// Remove existing user
app.get('#/users/:user/delete', function (c) {
var params = {};
// make confirm content
var purgeCheckbox = '<input type="checkbox">'+ y18n.t('purge_user_data_checkbox', [c.params['user']]) +'</input>';
var purgeAlertMessage = '<div class="warning" style="display: none">⚠ '+ y18n.t('purge_user_data_warning') +'</div>';
var confirmModalContent = $('<div>'+ y18n.t('confirm_delete', [c.params['user']]) +'<br><br>'+ purgeCheckbox +'<br>'+ purgeAlertMessage +'</div>');
// display confirm modal
c.confirm(
y18n.t('users'),
y18n.t('confirm_delete', [c.params['user']]),
confirmModalContent,
function(){
c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_delete_delete_4
c.redirect('#/users');
}, 'DELETE');
}, 'DELETE', params);
},
function(){
store.clear('slide');
c.redirect('#/users/'+ c.params['user']);
}
);
// toggle purge warning and parameter
confirmModalContent.find("input").click(function(){
if (confirmModalContent.find("input").is(':checked')) {
params.purge = "";
confirmModalContent.find(".warning").show();
}
else {
delete params.purge;
confirmModalContent.find(".warning").hide();
};
});
});
})();
})();

View file

@ -412,5 +412,7 @@
"name" : "Name",
"install_community_appslists_info" : "Community applications list allows you to install community maintained applications.<br />See the full list on <a href='https://yunohost.org/apps'>yunohost.org/apps</a>.",
"install_community_appslists_warning" : "Note that these applications packages are <strong>not</strong> official and not maintained by the YunoHost team.<br />Installing these applications is at your own risk and could break your system.",
"install_custom_app_appslists_info" : "Note that you can use alternative applications lists to install some other apps maintained by the YunoHost community."
"install_custom_app_appslists_info" : "Note that you can use alternative applications lists to install some other apps maintained by the YunoHost community.",
"purge_user_data_checkbox" : "Purge %s's data? (This will remove the content of it's home and mail directories.)",
"purge_user_data_warning" : "Purging user's data is not reversible. Be sure you know what you're doing!"
}