summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/settings/peopleBody.js4
-rw-r--r--client/components/settings/settingBody.jade8
-rw-r--r--client/components/settings/settingBody.js8
-rw-r--r--client/components/users/userHeader.jade10
-rw-r--r--client/components/users/userHeader.js9
-rw-r--r--i18n/en.i18n.json4
-rw-r--r--models/accountSettings.js9
7 files changed, 44 insertions, 8 deletions
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index b09f6599..a9f2247c 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -243,8 +243,8 @@ Template.editUserPopup.events({
} else Popup.close();
},
- 'click #deleteButton'() {
+ 'click #deleteButton': Popup.afterConfirm('userDelete', function() {
Users.remove(this.userId);
Popup.close();
- },
+ }),
});
diff --git a/client/components/settings/settingBody.jade b/client/components/settings/settingBody.jade
index 43836b2b..8eb584dc 100644
--- a/client/components/settings/settingBody.jade
+++ b/client/components/settings/settingBody.jade
@@ -114,6 +114,14 @@ template(name='accountSettings')
input.wekan-form-control#accounts-allowUserNameChange(type="radio" name="allowUserNameChange" value="false" checked="{{#unless allowUserNameChange}}checked{{/unless}}")
span {{_ 'no'}}
li
+ li.accounts-form
+ .title {{_ 'accounts-allowUserDelete'}}
+ .form-group.flex
+ input.wekan-form-control#accounts-allowUserDelete(type="radio" name="allowUserDelete" value="true" checked="{{#if allowUserDelete}}checked{{/if}}")
+ span {{_ 'yes'}}
+ input.wekan-form-control#accounts-allowUserDelete(type="radio" name="allowUserDelete" value="false" checked="{{#unless allowUserDelete}}checked{{/unless}}")
+ span {{_ 'no'}}
+ li
button.js-accounts-save.primary {{_ 'save'}}
template(name='announcementSettings')
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 4ec0c759..f9b5c08d 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -233,12 +233,17 @@ BlazeComponent.extendComponent({
$('input[name=allowEmailChange]:checked').val() === 'true';
const allowUserNameChange =
$('input[name=allowUserNameChange]:checked').val() === 'true';
+ const allowUserDelete =
+ $('input[name=allowUserDelete]:checked').val() === 'true';
AccountSettings.update('accounts-allowEmailChange', {
$set: { booleanValue: allowEmailChange },
});
AccountSettings.update('accounts-allowUserNameChange', {
$set: { booleanValue: allowUserNameChange },
});
+ AccountSettings.update('accounts-allowUserDelete', {
+ $set: { booleanValue: allowUserDelete },
+ });
},
allowEmailChange() {
@@ -247,6 +252,9 @@ BlazeComponent.extendComponent({
allowUserNameChange() {
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
},
+ allowUserDelete() {
+ return AccountSettings.findOne('accounts-allowUserDelete').booleanValue;
+ },
events() {
return [
diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade
index 2a3d04cc..946bdab1 100644
--- a/client/components/users/userHeader.jade
+++ b/client/components/users/userHeader.jade
@@ -55,8 +55,9 @@ template(name="editProfilePopup")
input.js-profile-email(type="email" value="{{emails.[0].address}}" readonly)
div.buttonsContainer
input.primary.wide(type="submit" value="{{_ 'save'}}")
- div
- input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
+ if allowUserDelete
+ div
+ input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
template(name="changePasswordPopup")
+atForm(state='changePwd')
@@ -82,3 +83,8 @@ template(name="changeSettingsPopup")
| {{_ 'show-cards-minimum-count'}}
input#show-cards-count-at.inline-input.left(type="number" value="#{showCardsCountAt}" min="0" max="99" onkeydown="return false")
input.js-apply-show-cards-at.left(type="submit" value="{{_ 'apply'}}")
+
+
+template(name="userDeletePopup")
+ p {{_ 'delete-user-confirm-popup'}}
+ button.js-confirm.negate.full(type="submit") {{_ 'delete'}}
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js
index 0434f647..36fb2020 100644
--- a/client/components/users/userHeader.js
+++ b/client/components/users/userHeader.js
@@ -35,6 +35,9 @@ Template.editProfilePopup.helpers({
allowUserNameChange() {
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
},
+ allowUserDelete() {
+ return AccountSettings.findOne('accounts-allowUserDelete').booleanValue;
+ },
});
Template.editProfilePopup.events({
@@ -104,11 +107,11 @@ Template.editProfilePopup.events({
});
} else Popup.back();
},
- 'click #deleteButton'() {
- Users.remove(Meteor.userId());
+ 'click #deleteButton': Popup.afterConfirm('userDelete', function() {
Popup.close();
+ Users.remove(Meteor.userId());
AccountsTemplates.logout();
- },
+ }),
});
// XXX For some reason the useraccounts autofocus isnt working in this case.
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 6274e08a..3edf1fce 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -722,5 +722,7 @@
"act-almostdue": "was reminding the current due (__timeValue__) of __card__ is approaching",
"act-pastdue": "was reminding the current due (__timeValue__) of __card__ is past",
"act-duenow": "was reminding the current due (__timeValue__) of __card__ is now",
- "act-atUserComment": "You were mentioned in [__board__] __card__"
+ "act-atUserComment": "You were mentioned in [__board__] __card__",
+ "delete-user-confirm-popup": "Are you sure you want to delete this account? There is no undo.",
+ "accounts-allowUserDelete": "Allow users to self delete their account"
}
diff --git a/models/accountSettings.js b/models/accountSettings.js
index c68e905c..ed1087ca 100644
--- a/models/accountSettings.js
+++ b/models/accountSettings.js
@@ -68,6 +68,15 @@ if (Meteor.isServer) {
},
},
);
+ AccountSettings.upsert(
+ { _id: 'accounts-allowUserDelete' },
+ {
+ $setOnInsert: {
+ booleanValue: false,
+ sort: 0,
+ },
+ },
+ );
});
}