mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-03 21:30:06 +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
|
type: string
|
||||||
description: Email address associated with the user account
|
description: Email address associated with the user account
|
||||||
example: dragonfruit@example.org
|
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:
|
postcount:
|
||||||
type: number
|
type: number
|
||||||
example: 1000
|
example: 1000
|
||||||
|
|||||||
@@ -242,7 +242,10 @@ define('admin/manage/users', [
|
|||||||
}
|
}
|
||||||
alerts.success('[[admin/manage/users:alerts.validate-email-success]]');
|
alerts.success('[[admin/manage/users:alerts.validate-email-success]]');
|
||||||
update('.notvalidated', false);
|
update('.notvalidated', false);
|
||||||
update('.validated', true);
|
update('.pending', false);
|
||||||
|
update('.expired', false);
|
||||||
|
update('.validated', false);
|
||||||
|
update('.validated-by-admin', true);
|
||||||
unselectAll();
|
unselectAll();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -187,11 +187,12 @@ async function loadUserInfo(callerUid, uids) {
|
|||||||
user.lastonlineISO = utils.toISOString(timestamp);
|
user.lastonlineISO = utils.toISOString(timestamp);
|
||||||
user.ips = ips[index];
|
user.ips = ips[index];
|
||||||
user.ip = ips[index] && ips[index][0] ? ips[index][0] : null;
|
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];
|
const confirmObj = confirmObjs[index];
|
||||||
user['email:expired'] = !confirmObj.expires || Date.now() >= confirmObj.expires;
|
user['email:expired'] = !confirmObj.expires || Date.now() >= confirmObj.expires;
|
||||||
user['email:pending'] = 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) => {
|
UserEmail.getEmailForValidation = async (uid) => {
|
||||||
// gets email from user:<uid> email field,
|
let email = '';
|
||||||
// if it isn't set fallbacks to confirm:<code> email field
|
// check email from confirmObj
|
||||||
let email = await user.getUserField(uid, 'email');
|
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) {
|
if (!email) {
|
||||||
// check email from confirmObj
|
email = await user.getUserField(uid, 'email');
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return email;
|
return email;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -104,21 +104,37 @@
|
|||||||
<i class="administrator fa fa-shield text-success{{{ if !users.administrator }}} hidden{{{ end }}}"></i>
|
<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>
|
<a href="{config.relative_path}/user/{users.userslug}"> {users.username}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-nowrap">
|
<td class="text-nowrap ">
|
||||||
{{{ if ./email }}}
|
<div class="d-flex flex-column gap-1">
|
||||||
<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>
|
{{{ 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}
|
<span class="notvalidated {{{ if (users.email:expired || (users.email:pending || users.email:confirmed)) }}} hidden{{{ end }}}">
|
||||||
{{{ else }}}
|
<i class="fa fa-fw fa-times text-danger" title="[[admin/manage/users:users.not-validated]]" data-bs-toggle="tooltip"></i>
|
||||||
<i class="noemail fa fa-fw fa-nbb-none text-muted""></i>
|
{./emailToConfirm}
|
||||||
<em class="text-muted">[[admin/manage/users:users.no-email]]</em>
|
</span>
|
||||||
{{{ end }}}
|
{{{ end }}}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{{ if ./ips.length }}}
|
{{{ if ./ips.length }}}
|
||||||
|
|||||||
Reference in New Issue
Block a user