mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #221 from eauchat/stretch-unstable
Added option to purge user's data when removing it from the admin panel
This commit is contained in:
commit
b5d112954d
3 changed files with 33 additions and 4 deletions
|
@ -269,6 +269,9 @@ button {
|
|||
|
||||
.content {
|
||||
.modal-body;
|
||||
.danger {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
|
||||
footer {
|
||||
|
|
|
@ -196,19 +196,43 @@
|
|||
|
||||
// Remove existing user
|
||||
app.get('#/users/:user/delete', function (c) {
|
||||
|
||||
var params = {};
|
||||
|
||||
// make confirm content
|
||||
var purgeCheckbox = '<div><input type="checkbox" id="purge-user-data" name="purge-user-data"> <label for="purge-user-data">'+ y18n.t('purge_user_data_checkbox', [c.params['user']]) +'</label></div>';
|
||||
var purgeAlertMessage = '<div class="danger" 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();
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
|
@ -414,5 +414,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!"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue