refactor: don't make db request if there is no code

This commit is contained in:
Barış Soner Uşaklı
2025-02-25 10:27:38 -05:00
parent 07957e8243
commit 53a2be9def

View File

@@ -53,7 +53,7 @@ UserEmail.getEmailForValidation = async (uid) => {
let email = '';
// check email from confirmObj
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)) {
email = confirmObj.email;
}