diff options
author | guillaume <guillaume.cassou@orange.fr> | 2019-07-30 11:57:21 +0200 |
---|---|---|
committer | guillaume <guillaume.cassou@orange.fr> | 2019-07-30 11:57:21 +0200 |
commit | 98e3b0ce77cc8c7367fc9cf592f4d6698d16e7f0 (patch) | |
tree | 838105411802757919aeb8a03085395f425c37d6 | |
parent | 84ba42f42e01f4f1c03bb29b8b92ab2b7f802e64 (diff) | |
download | wekan-98e3b0ce77cc8c7367fc9cf592f4d6698d16e7f0.tar.gz wekan-98e3b0ce77cc8c7367fc9cf592f4d6698d16e7f0.tar.bz2 wekan-98e3b0ce77cc8c7367fc9cf592f4d6698d16e7f0.zip |
Add admin setting to prevent users to self deleting their account
-rw-r--r-- | client/components/settings/settingBody.jade | 8 | ||||
-rw-r--r-- | client/components/settings/settingBody.js | 8 | ||||
-rw-r--r-- | client/components/users/userHeader.jade | 5 | ||||
-rw-r--r-- | client/components/users/userHeader.js | 3 | ||||
-rw-r--r-- | models/accountSettings.js | 9 |
5 files changed, 31 insertions, 2 deletions
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 99540cc0..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') diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js index 9693d7cf..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({ 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, + }, + }, + ); }); } |