mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
refactor: show both emails in user list
if user has a confirmed email and a pending email change show both in the acp
This commit is contained in:
@@ -646,6 +646,9 @@ UserObjectACP:
|
||||
type: string
|
||||
description: Email address associated with the user account
|
||||
example: dragonfruit@example.org
|
||||
emailToConfirm:
|
||||
type: string
|
||||
description: Email address user used during signup, this email is not associated with the user until it is confirmed by clicking the link in the confirmation email.
|
||||
postcount:
|
||||
type: number
|
||||
example: 1000
|
||||
|
||||
@@ -242,7 +242,10 @@ define('admin/manage/users', [
|
||||
}
|
||||
alerts.success('[[admin/manage/users:alerts.validate-email-success]]');
|
||||
update('.notvalidated', false);
|
||||
update('.validated', true);
|
||||
update('.pending', false);
|
||||
update('.expired', false);
|
||||
update('.validated', false);
|
||||
update('.validated-by-admin', true);
|
||||
unselectAll();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -187,11 +187,12 @@ async function loadUserInfo(callerUid, uids) {
|
||||
user.lastonlineISO = utils.toISOString(timestamp);
|
||||
user.ips = ips[index];
|
||||
user.ip = ips[index] && ips[index][0] ? ips[index][0] : null;
|
||||
if (confirmObjs[index]) {
|
||||
user.emailToConfirm = user.email;
|
||||
if (confirmObjs[index] && confirmObjs[index].email) {
|
||||
const confirmObj = confirmObjs[index];
|
||||
user['email:expired'] = !confirmObj.expires || Date.now() >= confirmObj.expires;
|
||||
user['email:pending'] = confirmObj.expires && Date.now() < confirmObj.expires;
|
||||
user.email = confirmObj.email;
|
||||
user.emailToConfirm = confirmObj.email;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,16 +45,16 @@ UserEmail.remove = async function (uid, sessionId) {
|
||||
};
|
||||
|
||||
UserEmail.getEmailForValidation = async (uid) => {
|
||||
// gets email from user:<uid> email field,
|
||||
// if it isn't set fallbacks to confirm:<code> email field
|
||||
let email = await user.getUserField(uid, 'email');
|
||||
let email = '';
|
||||
// check email from confirmObj
|
||||
const code = await db.get(`confirm:byUid:${uid}`);
|
||||
const confirmObj = await db.getObject(`confirm:${code}`);
|
||||
if (confirmObj && confirmObj.email && parseInt(uid, 10) === parseInt(confirmObj.uid, 10)) {
|
||||
email = confirmObj.email;
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
// check email from confirmObj
|
||||
const code = await db.get(`confirm:byUid:${uid}`);
|
||||
const confirmObj = await db.getObject(`confirm:${code}`);
|
||||
if (confirmObj && confirmObj.email && parseInt(uid, 10) === parseInt(confirmObj.uid, 10)) {
|
||||
email = confirmObj.email;
|
||||
}
|
||||
email = await user.getUserField(uid, 'email');
|
||||
}
|
||||
return email;
|
||||
};
|
||||
|
||||
@@ -104,21 +104,37 @@
|
||||
<i class="administrator fa fa-shield text-success{{{ if !users.administrator }}} hidden{{{ end }}}"></i>
|
||||
<a href="{config.relative_path}/user/{users.userslug}"> {users.username}</a>
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
{{{ if ./email }}}
|
||||
<i class="validated fa fa-fw fa-check text-success{{{ if !users.email:confirmed }}} hidden{{{ end }}}" title="[[admin/manage/users:users.validated]]" data-bs-toggle="tooltip"></i>
|
||||
<td class="text-nowrap ">
|
||||
<div class="d-flex flex-column gap-1">
|
||||
{{{ if (!./email && !./emailToConfirm) }}}
|
||||
<em class="text-muted">[[admin/manage/users:users.no-email]]</em>
|
||||
{{{ else }}}
|
||||
<span class="validated {{{ if !users.email:confirmed }}} hidden{{{ end }}}">
|
||||
<i class="fa fa-fw fa-check text-success" title="[[admin/manage/users:users.validated]]" data-bs-toggle="tooltip"></i>
|
||||
{{{ if ./email }}}{./email}{{{ end }}}
|
||||
</span>
|
||||
|
||||
<i class="pending fa fa-fw fa-clock-o text-warning{{{ if !users.email:pending }}} hidden{{{ end }}}" title="[[admin/manage/users:users.validation-pending]]" data-bs-toggle="tooltip"></i>
|
||||
<span class="validated-by-admin hidden">
|
||||
<i class="fa fa-fw fa-check text-success" title="[[admin/manage/users:users.validated]]" data-bs-toggle="tooltip"></i>
|
||||
{{{ if ./emailToConfirm }}}{./emailToConfirm}{{{ end }}}
|
||||
</span>
|
||||
|
||||
<i class="expired fa fa-fw fa-times text-danger{{{ if !users.email:expired }}} hidden{{{ end }}}" title="[[admin/manage/users:users.validation-expired]]" data-bs-toggle="tooltip"></i>
|
||||
<span class="pending {{{ if !users.email:pending }}} hidden{{{ end }}}">
|
||||
<i class="fa fa-fw fa-clock-o text-warning" title="[[admin/manage/users:users.validation-pending]]" data-bs-toggle="tooltip"></i>
|
||||
{./emailToConfirm}
|
||||
</span>
|
||||
|
||||
<i class="notvalidated fa fa-fw fa-times text-danger{{{ if (users.email:expired || (users.email:pending || users.email:confirmed)) }}} hidden{{{ end }}}" title="[[admin/manage/users:users.not-validated]]" data-bs-toggle="tooltip"></i>
|
||||
<span class="expired {{{ if !users.email:expired }}} hidden{{{ end }}}">
|
||||
<i class="fa fa-fw fa-times text-danger" title="[[admin/manage/users:users.validation-expired]]" data-bs-toggle="tooltip"></i>
|
||||
{./emailToConfirm}
|
||||
</span>
|
||||
|
||||
{./email}
|
||||
{{{ else }}}
|
||||
<i class="noemail fa fa-fw fa-nbb-none text-muted""></i>
|
||||
<em class="text-muted">[[admin/manage/users:users.no-email]]</em>
|
||||
{{{ end }}}
|
||||
<span class="notvalidated {{{ if (users.email:expired || (users.email:pending || users.email:confirmed)) }}} hidden{{{ end }}}">
|
||||
<i class="fa fa-fw fa-times text-danger" title="[[admin/manage/users:users.not-validated]]" data-bs-toggle="tooltip"></i>
|
||||
{./emailToConfirm}
|
||||
</span>
|
||||
{{{ end }}}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{{{ if ./ips.length }}}
|
||||
|
||||
Reference in New Issue
Block a user