summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorThuan Pham Quoc <thuanpq.io@gmail.com>2017-11-08 11:34:37 +0700
committerThuan Pham Quoc <thuanpq.io@gmail.com>2017-11-08 11:34:37 +0700
commitfa1d8cd5ef0834f882e6d34d356d5fea55eb6ea1 (patch)
tree5ccedab2b0c04a8f60890dbc61607dc59fe186d3 /client
parente3b7f85cc35b650e72259909608237ea0347a7fb (diff)
downloadwekan-fa1d8cd5ef0834f882e6d34d356d5fea55eb6ea1.tar.gz
wekan-fa1d8cd5ef0834f882e6d34d356d5fea55eb6ea1.tar.bz2
wekan-fa1d8cd5ef0834f882e6d34d356d5fea55eb6ea1.zip
Added update all user profile from admin panel
Diffstat (limited to 'client')
-rw-r--r--client/components/settings/peopleBody.js39
1 files changed, 24 insertions, 15 deletions
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index d59dc38b..d0da60d0 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -89,22 +89,25 @@ Template.editUserPopup.events({
const username = tpl.find('.js-profile-username').value.trim();
const initials = tpl.find('.js-profile-initials').value.trim();
const isAdmin = tpl.find('.js-profile-isadmin').value.trim();
+ const isActive = tpl.find('.js-profile-isactive').value.trim();
const email = tpl.find('.js-profile-email').value.trim();
- console.log('isAdmin', isAdmin);
let isChangeUserName = false;
let isChangeEmail = false;
+
Users.update(this.userId, {
$set: {
'profile.fullname': fullname,
'profile.initials': initials,
- 'isAdmin': true,
+ 'isAdmin': isAdmin === 'true',
+ 'loginDisabled': isActive === 'true',
},
});
isChangeUserName = username !== user.username;
isChangeEmail = email.toLowerCase() !== user.emails[0].address.toLowerCase();
+
if (isChangeUserName && isChangeEmail) {
- Meteor.call('setUsernameAndEmail', username, email.toLowerCase(), function (error) {
+ Meteor.call('setUsernameAndEmail', username, email.toLowerCase(), this.userId, function (error) {
const usernameMessageElement = tpl.$('.username-taken');
const emailMessageElement = tpl.$('.email-taken');
if (error) {
@@ -119,29 +122,35 @@ Template.editUserPopup.events({
} else {
usernameMessageElement.hide();
emailMessageElement.hide();
- Popup.back();
+ Popup.close();
}
});
} else if (isChangeUserName) {
- Meteor.call('setUsername', username, function (error) {
- const messageElement = tpl.$('.username-taken');
+ Meteor.call('setUsername', username, this.userId, function (error) {
+ const usernameMessageElement = tpl.$('.username-taken');
if (error) {
- messageElement.show();
+ const errorElement = error.error;
+ if (errorElement === 'username-already-taken') {
+ usernameMessageElement.show();
+ }
} else {
- messageElement.hide();
- Popup.back();
+ usernameMessageElement.hide();
+ Popup.close();
}
});
} else if (isChangeEmail) {
- Meteor.call('setEmail', email.toLowerCase(), function (error) {
- const messageElement = tpl.$('.email-taken');
+ Meteor.call('setEmail', email.toLowerCase(), this.userId, function (error) {
+ const emailMessageElement = tpl.$('.email-taken');
if (error) {
- messageElement.show();
+ const errorElement = error.error;
+ if (errorElement === 'email-already-taken') {
+ emailMessageElement.show();
+ }
} else {
- messageElement.hide();
- Popup.back();
+ emailMessageElement.hide();
+ Popup.close();
}
});
- } else Popup.back();
+ } else Popup.close();
},
});