mirror of
https://github.com/wekan/wekan.git
synced 2026-03-01 19:30:15 +01: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 {{_ 'active'}}
|
||||||
th
|
th
|
||||||
+newOrgRow
|
+newOrgRow
|
||||||
each user in orgList
|
each org in orgList
|
||||||
+orgRow(orgId=org._id)
|
+orgRow(orgId=org._id)
|
||||||
|
|
||||||
template(name="teamGeneral")
|
template(name="teamGeneral")
|
||||||
|
|
@ -100,6 +100,7 @@ template(name="peopleGeneral")
|
||||||
tr
|
tr
|
||||||
th {{_ 'username'}}
|
th {{_ 'username'}}
|
||||||
th {{_ 'fullname'}}
|
th {{_ 'fullname'}}
|
||||||
|
th {{_ 'initials'}}
|
||||||
th {{_ 'admin'}}
|
th {{_ 'admin'}}
|
||||||
th {{_ 'email'}}
|
th {{_ 'email'}}
|
||||||
th {{_ 'verified'}}
|
th {{_ 'verified'}}
|
||||||
|
|
@ -208,6 +209,10 @@ template(name="peopleRow")
|
||||||
td <s>{{ userData.profile.fullname }}</s>
|
td <s>{{ userData.profile.fullname }}</s>
|
||||||
else
|
else
|
||||||
td {{ userData.profile.fullname }}
|
td {{ userData.profile.fullname }}
|
||||||
|
if userData.loginDisabled
|
||||||
|
td <s>{{ userData.profile.initials }}</s>
|
||||||
|
else
|
||||||
|
td {{ userData.profile.initials }}
|
||||||
if userData.loginDisabled
|
if userData.loginDisabled
|
||||||
td
|
td
|
||||||
if userData.isAdmin
|
if userData.isAdmin
|
||||||
|
|
@ -261,18 +266,18 @@ template(name="editOrgPopup")
|
||||||
label.hide.orgId(type="text" value=org._id)
|
label.hide.orgId(type="text" value=org._id)
|
||||||
label
|
label
|
||||||
| {{_ 'orgDisplayName'}}
|
| {{_ 'orgDisplayName'}}
|
||||||
input.js-orgDisplayName(type="text" value=org.orgDisplayName required)
|
input.js-orgDisplayName(type="text" value=org.displayName required)
|
||||||
span.error.hide.orgname-taken
|
span.error.hide.orgname-taken
|
||||||
| {{_ 'error-orgname-taken'}}
|
| {{_ 'error-orgname-taken'}}
|
||||||
label
|
label
|
||||||
| {{_ 'orgDesc'}}
|
| {{_ 'orgDesc'}}
|
||||||
input.js-orgDesc(type="text" value=org.orgDesc required)
|
input.js-orgDesc(type="text" value=org.desc required)
|
||||||
label
|
label
|
||||||
| {{_ 'orgName'}}
|
| {{_ 'orgName'}}
|
||||||
input.js-orgName(type="text" value=org.orgName required)
|
input.js-orgName(type="text" value=org.name required)
|
||||||
label
|
label
|
||||||
| {{_ 'orgWebsite'}}
|
| {{_ 'orgWebsite'}}
|
||||||
input.js-orgWebsite(type="text" value=org.orgWebsite required)
|
input.js-orgWebsite(type="text" value=org.website required)
|
||||||
label
|
label
|
||||||
| {{_ 'active'}}
|
| {{_ 'active'}}
|
||||||
select.select-active.js-org-isactive
|
select.select-active.js-org-isactive
|
||||||
|
|
@ -311,9 +316,6 @@ template(name="editTeamPopup")
|
||||||
template(name="editUserPopup")
|
template(name="editUserPopup")
|
||||||
form
|
form
|
||||||
label.hide.userId(type="text" value=user._id)
|
label.hide.userId(type="text" value=user._id)
|
||||||
label
|
|
||||||
| {{_ 'fullname'}}
|
|
||||||
input.js-profile-fullname(type="text" value=user.profile.fullname required)
|
|
||||||
label
|
label
|
||||||
| {{_ 'username'}}
|
| {{_ 'username'}}
|
||||||
span.error.hide.username-taken
|
span.error.hide.username-taken
|
||||||
|
|
@ -322,6 +324,17 @@ template(name="editUserPopup")
|
||||||
input.js-profile-username(type="text" value=user.username readonly)
|
input.js-profile-username(type="text" value=user.username readonly)
|
||||||
else
|
else
|
||||||
input.js-profile-username(type="text" value=user.username required)
|
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
|
label
|
||||||
| {{_ 'email'}}
|
| {{_ 'email'}}
|
||||||
span.error.hide.email-taken
|
span.error.hide.email-taken
|
||||||
|
|
@ -331,10 +344,10 @@ template(name="editUserPopup")
|
||||||
else
|
else
|
||||||
input.js-profile-email(type="email" value="{{user.emails.[0].address}}" required)
|
input.js-profile-email(type="email" value="{{user.emails.[0].address}}" required)
|
||||||
label
|
label
|
||||||
| {{_ 'admin'}}
|
| {{_ 'verified'}}
|
||||||
select.select-role.js-profile-isadmin
|
select.select-verified.js-profile-email-verified
|
||||||
option(value="false") {{_ 'no'}}
|
option(value="false") {{_ 'no'}}
|
||||||
option(value="true" selected="{{user.isAdmin}}") {{_ 'yes'}}
|
option(value="true" selected="{{userData.emails.[0].verified}}") {{_ 'yes'}}
|
||||||
label
|
label
|
||||||
| {{_ 'active'}}
|
| {{_ 'active'}}
|
||||||
select.select-active.js-profile-isactive
|
select.select-active.js-profile-isactive
|
||||||
|
|
|
||||||
|
|
@ -399,18 +399,24 @@ Template.editUserPopup.events({
|
||||||
submit(event, templateInstance) {
|
submit(event, templateInstance) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const user = Users.findOne(this.userId);
|
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 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 password = templateInstance.find('.js-profile-password').value;
|
||||||
const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
|
const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
|
||||||
const isActive = templateInstance.find('.js-profile-isactive').value.trim();
|
const isActive = templateInstance.find('.js-profile-isactive').value.trim();
|
||||||
const email = templateInstance.find('.js-profile-email').value.trim();
|
const email = templateInstance.find('.js-profile-email').value.trim();
|
||||||
|
const verified = templateInstance
|
||||||
|
.find('.js-profile-email-verified')
|
||||||
|
.value.trim();
|
||||||
const authentication = templateInstance
|
const authentication = templateInstance
|
||||||
.find('.js-authenticationMethod')
|
.find('.js-authenticationMethod')
|
||||||
.value.trim();
|
.value.trim();
|
||||||
|
|
||||||
const isChangePassword = password.length > 0;
|
const isChangePassword = password.length > 0;
|
||||||
const isChangeUserName = username !== user.username;
|
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,
|
// If previously email address has not been set, it is undefined,
|
||||||
// check for undefined, and allow adding email address.
|
// check for undefined, and allow adding email address.
|
||||||
|
|
@ -433,6 +439,14 @@ Template.editUserPopup.events({
|
||||||
Meteor.call('setPassword', password, this.userId);
|
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) {
|
if (isChangeUserName && isChangeEmail) {
|
||||||
Meteor.call(
|
Meteor.call(
|
||||||
'setUsernameAndEmail',
|
'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
|
// we accept userId, username, email
|
||||||
inviteUserToBoard(username, boardId) {
|
inviteUserToBoard(username, boardId) {
|
||||||
check(username, String);
|
check(username, String);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ Meteor.publish('people', function(query, limit) {
|
||||||
fields: {
|
fields: {
|
||||||
username: 1,
|
username: 1,
|
||||||
'profile.fullname': 1,
|
'profile.fullname': 1,
|
||||||
|
'profile.initials': 1,
|
||||||
isAdmin: 1,
|
isAdmin: 1,
|
||||||
emails: 1,
|
emails: 1,
|
||||||
createdAt: 1,
|
createdAt: 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue