mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Add admin setting to prevent users to self deleting their account
This commit is contained in:
parent
84ba42f42e
commit
98e3b0ce77
5 changed files with 31 additions and 2 deletions
|
|
@ -113,6 +113,14 @@ template(name='accountSettings')
|
||||||
span {{_ 'yes'}}
|
span {{_ 'yes'}}
|
||||||
input.wekan-form-control#accounts-allowUserNameChange(type="radio" name="allowUserNameChange" value="false" checked="{{#unless allowUserNameChange}}checked{{/unless}}")
|
input.wekan-form-control#accounts-allowUserNameChange(type="radio" name="allowUserNameChange" value="false" checked="{{#unless allowUserNameChange}}checked{{/unless}}")
|
||||||
span {{_ 'no'}}
|
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
|
li
|
||||||
button.js-accounts-save.primary {{_ 'save'}}
|
button.js-accounts-save.primary {{_ 'save'}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,12 +233,17 @@ BlazeComponent.extendComponent({
|
||||||
$('input[name=allowEmailChange]:checked').val() === 'true';
|
$('input[name=allowEmailChange]:checked').val() === 'true';
|
||||||
const allowUserNameChange =
|
const allowUserNameChange =
|
||||||
$('input[name=allowUserNameChange]:checked').val() === 'true';
|
$('input[name=allowUserNameChange]:checked').val() === 'true';
|
||||||
|
const allowUserDelete =
|
||||||
|
$('input[name=allowUserDelete]:checked').val() === 'true';
|
||||||
AccountSettings.update('accounts-allowEmailChange', {
|
AccountSettings.update('accounts-allowEmailChange', {
|
||||||
$set: { booleanValue: allowEmailChange },
|
$set: { booleanValue: allowEmailChange },
|
||||||
});
|
});
|
||||||
AccountSettings.update('accounts-allowUserNameChange', {
|
AccountSettings.update('accounts-allowUserNameChange', {
|
||||||
$set: { booleanValue: allowUserNameChange },
|
$set: { booleanValue: allowUserNameChange },
|
||||||
});
|
});
|
||||||
|
AccountSettings.update('accounts-allowUserDelete', {
|
||||||
|
$set: { booleanValue: allowUserDelete },
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
allowEmailChange() {
|
allowEmailChange() {
|
||||||
|
|
@ -247,6 +252,9 @@ BlazeComponent.extendComponent({
|
||||||
allowUserNameChange() {
|
allowUserNameChange() {
|
||||||
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
|
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
|
||||||
},
|
},
|
||||||
|
allowUserDelete() {
|
||||||
|
return AccountSettings.findOne('accounts-allowUserDelete').booleanValue;
|
||||||
|
},
|
||||||
|
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ template(name="editProfilePopup")
|
||||||
input.js-profile-email(type="email" value="{{emails.[0].address}}" readonly)
|
input.js-profile-email(type="email" value="{{emails.[0].address}}" readonly)
|
||||||
div.buttonsContainer
|
div.buttonsContainer
|
||||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||||
div
|
if allowUserDelete
|
||||||
input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
|
div
|
||||||
|
input#deleteButton.primary.wide(type="button" value="{{_ 'delete'}}")
|
||||||
|
|
||||||
template(name="changePasswordPopup")
|
template(name="changePasswordPopup")
|
||||||
+atForm(state='changePwd')
|
+atForm(state='changePwd')
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ Template.editProfilePopup.helpers({
|
||||||
allowUserNameChange() {
|
allowUserNameChange() {
|
||||||
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
|
return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
|
||||||
},
|
},
|
||||||
|
allowUserDelete() {
|
||||||
|
return AccountSettings.findOne('accounts-allowUserDelete').booleanValue;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.editProfilePopup.events({
|
Template.editProfilePopup.events({
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,15 @@ if (Meteor.isServer) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
AccountSettings.upsert(
|
||||||
|
{ _id: 'accounts-allowUserDelete' },
|
||||||
|
{
|
||||||
|
$setOnInsert: {
|
||||||
|
booleanValue: false,
|
||||||
|
sort: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue