summaryrefslogtreecommitdiffstats
path: root/client/components
diff options
context:
space:
mode:
authorThiago Fernando S. dos Santos <thiagofernando@outlook.com>2018-05-04 16:44:50 -0300
committerThiago Fernando S. dos Santos <thiagofernando@outlook.com>2018-05-04 16:44:50 -0300
commit2fa1b3122d2acc65219e5d09974add21ac4c76fd (patch)
tree6996d20e50378be8a2e80aa68ee30b341605fcbb /client/components
parentc48c18c4e9c3d86b2ad19c98b24b9240bfb69ffc (diff)
downloadwekan-2fa1b3122d2acc65219e5d09974add21ac4c76fd.tar.gz
wekan-2fa1b3122d2acc65219e5d09974add21ac4c76fd.tar.bz2
wekan-2fa1b3122d2acc65219e5d09974add21ac4c76fd.zip
Includes possibility to block username change
Diffstat (limited to 'client/components')
-rw-r--r--client/components/settings/settingBody.js67
-rw-r--r--client/components/users/userHeader.jade5
-rw-r--r--client/components/users/userHeader.js3
3 files changed, 47 insertions, 28 deletions
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 8c1ff1c7..7230d893 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -23,7 +23,7 @@ BlazeComponent.extendComponent({
checkField(selector) {
const value = $(selector).val();
- if(!value || value.trim() === ''){
+ if (!value || value.trim() === '') {
$(selector).parents('li.smtp-form').addClass('has-error');
throw Error('blank field');
} else {
@@ -31,7 +31,7 @@ BlazeComponent.extendComponent({
}
},
- currentSetting(){
+ currentSetting() {
return Settings.findOne();
},
@@ -44,23 +44,23 @@ BlazeComponent.extendComponent({
sort: ['title'],
});
},
- toggleRegistration(){
+ toggleRegistration() {
this.setLoading(true);
const registrationClosed = this.currentSetting().disableRegistration;
- Settings.update(Settings.findOne()._id, {$set:{disableRegistration: !registrationClosed}});
+ Settings.update(Settings.findOne()._id, {$set: {disableRegistration: !registrationClosed}});
this.setLoading(false);
- if(registrationClosed){
+ if (registrationClosed) {
$('.invite-people').slideUp();
- }else{
+ } else {
$('.invite-people').slideDown();
}
},
- toggleTLS(){
+ toggleTLS() {
$('#mail-server-tls').toggleClass('is-checked');
},
- switchMenu(event){
+ switchMenu(event) {
const target = $(event.target);
- if(!target.hasClass('active')){
+ if (!target.hasClass('active')) {
$('.side-menu li.active').removeClass('active');
target.parent().addClass('active');
const targetID = target.data('id');
@@ -71,9 +71,9 @@ BlazeComponent.extendComponent({
}
},
- checkBoard(event){
+ checkBoard(event) {
let target = $(event.target);
- if(!target.hasClass('js-toggle-board-choose')){
+ if (!target.hasClass('js-toggle-board-choose')) {
target = target.parent();
}
const checkboxId = target.attr('id');
@@ -81,7 +81,7 @@ BlazeComponent.extendComponent({
$(`#${checkboxId}`).toggleClass('is-checked');
},
- inviteThroughEmail(){
+ inviteThroughEmail() {
const emails = $('#email-to-invite').val().trim().split('\n').join(',').split(',');
const boardsToInvite = [];
$('.js-toggle-board-choose .materialCheckBox.is-checked').each(function () {
@@ -104,19 +104,23 @@ BlazeComponent.extendComponent({
}
},
- saveMailServerInfo(){
+ saveMailServerInfo() {
this.setLoading(true);
$('li').removeClass('has-error');
- try{
+ try {
const host = this.checkField('#mail-server-host');
const port = this.checkField('#mail-server-port');
const username = $('#mail-server-username').val().trim();
const password = $('#mail-server-password').val().trim();
const from = this.checkField('#mail-server-from');
const tls = $('#mail-server-tls.is-checked').length > 0;
- Settings.update(Settings.findOne()._id, {$set:{'mailServer.host':host, 'mailServer.port': port, 'mailServer.username': username,
- 'mailServer.password': password, 'mailServer.enableTLS': tls, 'mailServer.from': from}});
+ Settings.update(Settings.findOne()._id, {
+ $set: {
+ 'mailServer.host': host, 'mailServer.port': port, 'mailServer.username': username,
+ 'mailServer.password': password, 'mailServer.enableTLS': tls, 'mailServer.from': from,
+ },
+ });
} catch (e) {
return;
} finally {
@@ -136,11 +140,12 @@ BlazeComponent.extendComponent({
const message = `${TAPi18n.__(err.error)}\n${reason}`;
console.log(message, err);
alert(message);
- } /* eslint-enable no-console */
+ }
+ /* eslint-enable no-console */
});
},
- events(){
+ events() {
return [{
'click a.js-toggle-registration': this.toggleRegistration,
'click a.js-toggle-tls': this.toggleTLS,
@@ -154,20 +159,28 @@ BlazeComponent.extendComponent({
}).register('setting');
BlazeComponent.extendComponent({
- saveAllowEmailChange() {
+
+ saveAccountsChange() {
const allowEmailChange = ($('input[name=allowEmailChange]:checked').val() === 'true');
+ const allowUserNameChange = ($('input[name=allowUserNameChange]:checked').val() === 'true');
AccountSettings.update('accounts-allowEmailChange', {
- $set: { 'booleanValue': allowEmailChange },
+ $set: {'booleanValue': allowEmailChange},
+ });
+ AccountSettings.update('accounts-allowUserNameChange', {
+ $set: {'booleanValue': allowUserNameChange},
});
},
allowEmailChange() {
return AccountSettings.findOne('accounts-allowEmailChange').booleanValue;
},
+ allowUserNameChange() {
+ return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
+ },
events() {
return [{
- 'click button.js-accounts-save': this.saveAllowEmailChange,
+ 'click button.js-accounts-save': this.saveAccountsChange,
}];
},
}).register('accountSettings');
@@ -181,27 +194,27 @@ BlazeComponent.extendComponent({
this.loading.set(w);
},
- currentSetting(){
+ currentSetting() {
return Announcements.findOne();
},
saveMessage() {
const message = $('#admin-announcement').val().trim();
Announcements.update(Announcements.findOne()._id, {
- $set: { 'body': message },
+ $set: {'body': message},
});
},
- toggleActive(){
+ toggleActive() {
this.setLoading(true);
const isActive = this.currentSetting().enabled;
Announcements.update(Announcements.findOne()._id, {
- $set:{ 'enabled': !isActive},
+ $set: {'enabled': !isActive},
});
this.setLoading(false);
- if(isActive){
+ if (isActive) {
$('.admin-announcement').slideUp();
- }else{
+ } else {
$('.admin-announcement').slideDown();
}
},
diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade
index 4ac59f45..a8fdb143 100644
--- a/client/components/users/userHeader.jade
+++ b/client/components/users/userHeader.jade
@@ -33,7 +33,10 @@ template(name="editProfilePopup")
| {{_ 'username'}}
span.error.hide.username-taken
| {{_ 'error-username-taken'}}
- input.js-profile-username(type="text" value=username)
+ if allowUserNameChange
+ input.js-profile-username(type="text" value=username)
+ else
+ input.js-profile-username(type="text" value=username readonly)
label
| {{_ 'initials'}}
input.js-profile-initials(type="text" value=profile.initials)
diff --git a/client/components/users/userHeader.js b/client/components/users/userHeader.js
index be7d4dcb..d96a9b3d 100644
--- a/client/components/users/userHeader.js
+++ b/client/components/users/userHeader.js
@@ -24,6 +24,9 @@ Template.editProfilePopup.helpers({
allowEmailChange() {
return AccountSettings.findOne('accounts-allowEmailChange').booleanValue;
},
+ allowUserNameChange() {
+ return AccountSettings.findOne('accounts-allowUserNameChange').booleanValue;
+ },
});
Template.editProfilePopup.events({