From 6d81688ddec60a27d2b605065e3fe98d96e6a294 Mon Sep 17 00:00:00 2001 From: philc Date: Tue, 24 Sep 2024 14:41:06 +0200 Subject: [PATCH] fix bug email recovery with alias --- models/Pagans.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/models/Pagans.js b/models/Pagans.js index cd18aca..d0ab126 100644 --- a/models/Pagans.js +++ b/models/Pagans.js @@ -49,7 +49,15 @@ Pagans.logout = (alias, tribe, xdays, xhash) => { */ Pagans.keyrecovery = (emailalias, tribe, search, lg) => { - if (log) console.log(currentmod,":try to recover emailalias, tribe, search, lg:",emailalias,tribe,search,lg); + if (log) + console.log( + currentmod, + ":try to recover emailalias, tribe, search, lg:", + emailalias, + tribe, + search, + lg + ); if (!["email", "alias"].includes(emailalias)) { return { status: 406, @@ -71,14 +79,13 @@ Pagans.keyrecovery = (emailalias, tribe, search, lg) => { } } else { const personpath = `../../${tribe}/objects/persons/itm/${search}.json`; + if (fs.existsSync(personpath)) { - const person=fs.readFileSync(personpath) - if (person.recoveryauth) - emaillist.push({ alias: search, tribe, lg }); + const person = fs.readJSONSync(personpath); + if (person.recoveryauth) emaillist.push({ alias: search, tribe, lg }); } } emaillist.forEach((e) => { - console.log(e); const ret = Pagans.sendmailkey(e); });