mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Allow to edit email verified and initials at Admin Panel/People/People.
Thanks to xet7 ! Fixes #1426
This commit is contained in:
parent
d0cdc33c19
commit
d03e2170dd
4 changed files with 68 additions and 12 deletions
|
@ -76,7 +76,7 @@ template(name="orgGeneral")
|
|||
th {{_ 'active'}}
|
||||
th
|
||||
+newOrgRow
|
||||
each user in orgList
|
||||
each org in orgList
|
||||
+orgRow(orgId=org._id)
|
||||
|
||||
template(name="teamGeneral")
|
||||
|
@ -100,6 +100,7 @@ template(name="peopleGeneral")
|
|||
tr
|
||||
th {{_ 'username'}}
|
||||
th {{_ 'fullname'}}
|
||||
th {{_ 'initials'}}
|
||||
th {{_ 'admin'}}
|
||||
th {{_ 'email'}}
|
||||
th {{_ 'verified'}}
|
||||
|
@ -208,6 +209,10 @@ template(name="peopleRow")
|
|||
td <s>{{ userData.profile.fullname }}</s>
|
||||
else
|
||||
td {{ userData.profile.fullname }}
|
||||
if userData.loginDisabled
|
||||
td <s>{{ userData.profile.initials }}</s>
|
||||
else
|
||||
td {{ userData.profile.initials }}
|
||||
if userData.loginDisabled
|
||||
td
|
||||
if userData.isAdmin
|
||||
|
@ -261,18 +266,18 @@ template(name="editOrgPopup")
|
|||
label.hide.orgId(type="text" value=org._id)
|
||||
label
|
||||
| {{_ 'orgDisplayName'}}
|
||||
input.js-orgDisplayName(type="text" value=org.orgDisplayName required)
|
||||
input.js-orgDisplayName(type="text" value=org.displayName required)
|
||||
span.error.hide.orgname-taken
|
||||
| {{_ 'error-orgname-taken'}}
|
||||
label
|
||||
| {{_ 'orgDesc'}}
|
||||
input.js-orgDesc(type="text" value=org.orgDesc required)
|
||||
input.js-orgDesc(type="text" value=org.desc required)
|
||||
label
|
||||
| {{_ 'orgName'}}
|
||||
input.js-orgName(type="text" value=org.orgName required)
|
||||
input.js-orgName(type="text" value=org.name required)
|
||||
label
|
||||
| {{_ 'orgWebsite'}}
|
||||
input.js-orgWebsite(type="text" value=org.orgWebsite required)
|
||||
input.js-orgWebsite(type="text" value=org.website required)
|
||||
label
|
||||
| {{_ 'active'}}
|
||||
select.select-active.js-org-isactive
|
||||
|
@ -311,9 +316,6 @@ template(name="editTeamPopup")
|
|||
template(name="editUserPopup")
|
||||
form
|
||||
label.hide.userId(type="text" value=user._id)
|
||||
label
|
||||
| {{_ 'fullname'}}
|
||||
input.js-profile-fullname(type="text" value=user.profile.fullname required)
|
||||
label
|
||||
| {{_ 'username'}}
|
||||
span.error.hide.username-taken
|
||||
|
@ -322,6 +324,17 @@ template(name="editUserPopup")
|
|||
input.js-profile-username(type="text" value=user.username readonly)
|
||||
else
|
||||
input.js-profile-username(type="text" value=user.username required)
|
||||
label
|
||||
| {{_ 'fullname'}}
|
||||
input.js-profile-fullname(type="text" value=user.profile.fullname required)
|
||||
label
|
||||
| {{_ 'initials'}}
|
||||
input.js-profile-initials(type="text" value=user.profile.initials)
|
||||
label
|
||||
| {{_ 'admin'}}
|
||||
select.select-role.js-profile-isadmin
|
||||
option(value="false") {{_ 'no'}}
|
||||
option(value="true" selected="{{user.isAdmin}}") {{_ 'yes'}}
|
||||
label
|
||||
| {{_ 'email'}}
|
||||
span.error.hide.email-taken
|
||||
|
@ -331,10 +344,10 @@ template(name="editUserPopup")
|
|||
else
|
||||
input.js-profile-email(type="email" value="{{user.emails.[0].address}}" required)
|
||||
label
|
||||
| {{_ 'admin'}}
|
||||
select.select-role.js-profile-isadmin
|
||||
| {{_ 'verified'}}
|
||||
select.select-verified.js-profile-email-verified
|
||||
option(value="false") {{_ 'no'}}
|
||||
option(value="true" selected="{{user.isAdmin}}") {{_ 'yes'}}
|
||||
option(value="true" selected="{{userData.emails.[0].verified}}") {{_ 'yes'}}
|
||||
label
|
||||
| {{_ 'active'}}
|
||||
select.select-active.js-profile-isactive
|
||||
|
|
|
@ -399,18 +399,24 @@ Template.editUserPopup.events({
|
|||
submit(event, templateInstance) {
|
||||
event.preventDefault();
|
||||
const user = Users.findOne(this.userId);
|
||||
const fullname = templateInstance.find('.js-profile-fullname').value.trim();
|
||||
const username = templateInstance.find('.js-profile-username').value.trim();
|
||||
const fullname = templateInstance.find('.js-profile-fullname').value.trim();
|
||||
const initials = templateInstance.find('.js-profile-initials').value.trim();
|
||||
const password = templateInstance.find('.js-profile-password').value;
|
||||
const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
|
||||
const isActive = templateInstance.find('.js-profile-isactive').value.trim();
|
||||
const email = templateInstance.find('.js-profile-email').value.trim();
|
||||
const verified = templateInstance
|
||||
.find('.js-profile-email-verified')
|
||||
.value.trim();
|
||||
const authentication = templateInstance
|
||||
.find('.js-authenticationMethod')
|
||||
.value.trim();
|
||||
|
||||
const isChangePassword = password.length > 0;
|
||||
const isChangeUserName = username !== user.username;
|
||||
const isChangeInitials = initials.length > 0;
|
||||
const isChangeEmailVerified = verified !== user.emails[0].verified;
|
||||
|
||||
// If previously email address has not been set, it is undefined,
|
||||
// check for undefined, and allow adding email address.
|
||||
|
@ -433,6 +439,14 @@ Template.editUserPopup.events({
|
|||
Meteor.call('setPassword', password, this.userId);
|
||||
}
|
||||
|
||||
if (isChangeEmailVerified) {
|
||||
Meteor.call('setEmailVerified', email, verified === 'true', this.userId);
|
||||
}
|
||||
|
||||
if (isChangeInitials) {
|
||||
Meteor.call('setInitials', initials, this.userId);
|
||||
}
|
||||
|
||||
if (isChangeUserName && isChangeEmail) {
|
||||
Meteor.call(
|
||||
'setUsernameAndEmail',
|
||||
|
|
|
@ -836,6 +836,34 @@ if (Meteor.isServer) {
|
|||
}
|
||||
}
|
||||
},
|
||||
setEmailVerified(email, verified, userId) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(email, String);
|
||||
check(verified, Boolean);
|
||||
check(userId, String);
|
||||
Users.update(userId, {
|
||||
$set: {
|
||||
emails: [
|
||||
{
|
||||
address: email,
|
||||
verified,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
setInitials(initials, userId) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(initials, String);
|
||||
check(userId, String);
|
||||
Users.update(userId, {
|
||||
$set: {
|
||||
'profile.initials': initials,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// we accept userId, username, email
|
||||
inviteUserToBoard(username, boardId) {
|
||||
check(username, String);
|
||||
|
|
|
@ -14,6 +14,7 @@ Meteor.publish('people', function(query, limit) {
|
|||
fields: {
|
||||
username: 1,
|
||||
'profile.fullname': 1,
|
||||
'profile.initials': 1,
|
||||
isAdmin: 1,
|
||||
emails: 1,
|
||||
createdAt: 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue