diff options
author | Lauri Ojansivu <x@xet7.org> | 2017-12-12 14:32:37 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2017-12-12 14:32:37 +0200 |
commit | 047e22571e39d0459ce53c765fdb19060d71756d (patch) | |
tree | 8e255f5f187e69d3659781b3f7eb027f8a51bd4f /client/components/settings | |
parent | ed95542b675aa34dee1c6eaafb1fb3a157215039 (diff) | |
parent | f115e33f6672bfe6fa625b190a01514f8aaa8870 (diff) | |
download | wekan-047e22571e39d0459ce53c765fdb19060d71756d.tar.gz wekan-047e22571e39d0459ce53c765fdb19060d71756d.tar.bz2 wekan-047e22571e39d0459ce53c765fdb19060d71756d.zip |
Merge branch 'devel'
Diffstat (limited to 'client/components/settings')
-rw-r--r-- | client/components/settings/peopleBody.jade | 7 | ||||
-rw-r--r-- | client/components/settings/peopleBody.js | 14 | ||||
-rw-r--r-- | client/components/settings/settingBody.js | 12 |
3 files changed, 18 insertions, 15 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) { diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js index 5b015918..8c1ff1c7 100644 --- a/client/components/settings/settingBody.js +++ b/client/components/settings/settingBody.js @@ -1,8 +1,3 @@ -Meteor.subscribe('setting'); -Meteor.subscribe('mailServer'); -Meteor.subscribe('accountSettings'); -Meteor.subscribe('announcements'); - BlazeComponent.extendComponent({ onCreated() { this.error = new ReactiveVar(''); @@ -11,6 +6,11 @@ BlazeComponent.extendComponent({ this.emailSetting = new ReactiveVar(false); this.accountSetting = new ReactiveVar(false); this.announcementSetting = new ReactiveVar(false); + + Meteor.subscribe('setting'); + Meteor.subscribe('mailServer'); + Meteor.subscribe('accountSettings'); + Meteor.subscribe('announcements'); }, setError(error) { @@ -116,7 +116,7 @@ BlazeComponent.extendComponent({ 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}}); + 'mailServer.password': password, 'mailServer.enableTLS': tls, 'mailServer.from': from}}); } catch (e) { return; } finally { |