aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/lnurl.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js
index f841b87f..3e32b1f2 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -99,13 +99,15 @@ lnurlServer.bindToHook(
let username = logins[k1];
if (!username) {
- user = (await db.Key.findOne({
+ const keyObj = await db.Key.findOne({
where: { hex: key },
include: [{
model: db.User,
as: 'user'
}],
- })).user;
+ });
+
+ if (keyObj) ({ user } = keyObj);
if (!user) {
let ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;