aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-08 07:22:23 +0000
committerAdam Soltys <[email protected]>2023-01-08 07:22:23 +0000
commit50548775d05d6ac3c14595f7564607dc028495b6 (patch)
tree2298e532611f2d46919a7169f95a8ac45316c962 /lib
parentfc22686471eac52ad0cf8b688310c6758b61fea4 (diff)
downloadcoinos-server-50548775d05d6ac3c14595f7564607dc028495b6.tar.gz
coinos-server-50548775d05d6ac3c14595f7564607dc028495b6.zip
prioritize uuid in jwt payload
Diffstat (limited to 'lib')
-rw-r--r--lib/nostr.js1
-rw-r--r--lib/passport.js5
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/nostr.js b/lib/nostr.js
index e1d2f68e..d170fed3 100644
--- a/lib/nostr.js
+++ b/lib/nostr.js
@@ -161,7 +161,6 @@ pool.on("event", async (relay, sub, ev) => {
coinos.send(ev);
} else if (sub.includes("notes")) {
let pubkey = sub.split(":")[0];
- if (relay.url === config.relay) console.log(ev)
await redis.sAdd(pubkey, ev.id);
await redis.set(`ev:${ev.id}`, JSON.stringify(ev));
}
diff --git a/lib/passport.js b/lib/passport.js
index 1244aab5..8b58e305 100644
--- a/lib/passport.js
+++ b/lib/passport.js
@@ -38,10 +38,10 @@ fastifyPassport.use(
let { username, uuid } = payload;
let where = {};
- if (username)
+ if (uuid) where.uuid = uuid;
+ else if (username)
where.username = { [Op.or]: [username, username.replace(/ /g, "")] };
- if (uuid) where.uuid = uuid;
let user = await db.User.findOne({
where,
@@ -51,6 +51,7 @@ fastifyPassport.use(
if (user.locked) throw new Error("account is locked");
next(null, user);
} catch (e) {
+ console.log("payload", payload)
if (!e.message.includes("locked")) {
console.log(e);
err("problem logging in", e);