diff --git a/src/css/style.less b/src/css/style.less index 5eaaf22f..f8627a09 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -269,6 +269,9 @@ button { .content { .modal-body; + .danger { + color: red; + } } footer { diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js index ebfa61fe..92e235ad 100644 --- a/src/js/yunohost/controllers/users.js +++ b/src/js/yunohost/controllers/users.js @@ -196,19 +196,43 @@ // Remove existing user app.get('#/users/:user/delete', function (c) { + + var params = {}; + + // make confirm content + var purgeCheckbox = '
'; + var purgeAlertMessage = ''; + var confirmModalContent = $('
'+ y18n.t('confirm_delete', [c.params['user']]) +'

'+ purgeCheckbox +'
'+ purgeAlertMessage +'
'); + + // 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(); + }; + + }); + }); -})(); \ No newline at end of file +})(); diff --git a/src/locales/en.json b/src/locales/en.json index 5bf5999b..a9af68b3 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -414,5 +414,7 @@ "name" : "Name", "install_community_appslists_info" : "Community applications list allows you to install community maintained applications.
See the full list on yunohost.org/apps.", "install_community_appslists_warning" : "Note that these applications packages are not official and not maintained by the YunoHost team.
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!" }