diff options
author | Thuan Pham Quoc <thuanpq.io@gmail.com> | 2017-12-01 15:55:53 +0700 |
---|---|---|
committer | Thuan Pham Quoc <thuanpq.io@gmail.com> | 2017-12-01 15:55:53 +0700 |
commit | 22e369804b2a6ed82a6da2c469519cd7252693a0 (patch) | |
tree | a48d4a60683dc0419147accd3041230f8b4d1a2a /client | |
parent | 54036fd7a3ac9bf25b6c601890491af66571d5ff (diff) | |
download | wekan-22e369804b2a6ed82a6da2c469519cd7252693a0.tar.gz wekan-22e369804b2a6ed82a6da2c469519cd7252693a0.tar.bz2 wekan-22e369804b2a6ed82a6da2c469519cd7252693a0.zip |
Allow admin to change user password in admin panel
Diffstat (limited to 'client')
-rw-r--r-- | client/components/settings/peopleBody.jade | 7 | ||||
-rw-r--r-- | client/components/settings/peopleBody.js | 14 |
2 files changed, 12 insertions, 9 deletions
diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade index d6568720..a3506a24 100644 --- a/client/components/settings/peopleBody.jade +++ b/client/components/settings/peopleBody.jade @@ -68,9 +68,6 @@ template(name="editUserPopup") | {{_ 'error-username-taken'}} input.js-profile-username(type="text" value=user.username) label - | {{_ 'initials'}} - input.js-profile-initials(type="text" value=user.profile.initials) - label | {{_ 'email'}} span.error.hide.email-taken | {{_ 'error-email-taken'}} @@ -85,5 +82,9 @@ template(name="editUserPopup") select.select-active.js-profile-isactive option(value="false") {{_ 'yes'}} option(value="true" selected="{{user.loginDisabled}}") {{_ 'no'}} + hr + label + | {{_ 'password'}} + input.js-profile-password(type="password") input.primary.wide(type="submit" value="{{_ 'save'}}") diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js index d0da60d0..7cc992f2 100644 --- a/client/components/settings/peopleBody.js +++ b/client/components/settings/peopleBody.js @@ -87,24 +87,26 @@ Template.editUserPopup.events({ const user = Users.findOne(this.userId); const fullname = tpl.find('.js-profile-fullname').value.trim(); const username = tpl.find('.js-profile-username').value.trim(); - const initials = tpl.find('.js-profile-initials').value.trim(); + const password = tpl.find('.js-profile-password').value; 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(); - let isChangeUserName = false; - let isChangeEmail = false; + + const isChangePassword = password.length > 0; + const isChangeUserName = username !== user.username; + const isChangeEmail = email.toLowerCase() !== user.emails[0].address.toLowerCase(); Users.update(this.userId, { $set: { 'profile.fullname': fullname, - 'profile.initials': initials, 'isAdmin': isAdmin === 'true', 'loginDisabled': isActive === 'true', }, }); - isChangeUserName = username !== user.username; - isChangeEmail = email.toLowerCase() !== user.emails[0].address.toLowerCase(); + if(isChangePassword){ + Meteor.call('setPassword', password, this.userId); + } if (isChangeUserName && isChangeEmail) { Meteor.call('setUsernameAndEmail', username, email.toLowerCase(), this.userId, function (error) { |