mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
refactor: don't make db request if there is no code
This commit is contained in:
@@ -53,7 +53,7 @@ UserEmail.getEmailForValidation = async (uid) => {
|
|||||||
let email = '';
|
let email = '';
|
||||||
// check email from confirmObj
|
// check email from confirmObj
|
||||||
const code = await db.get(`confirm:byUid:${uid}`);
|
const code = await db.get(`confirm:byUid:${uid}`);
|
||||||
const confirmObj = await db.getObject(`confirm:${code}`);
|
const confirmObj = code ? await db.getObject(`confirm:${code}`) : null;
|
||||||
if (confirmObj && confirmObj.email && parseInt(uid, 10) === parseInt(confirmObj.uid, 10)) {
|
if (confirmObj && confirmObj.email && parseInt(uid, 10) === parseInt(confirmObj.uid, 10)) {
|
||||||
email = confirmObj.email;
|
email = confirmObj.email;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user