diff options
| author | Adam Soltys <[email protected]> | 2020-07-07 19:59:31 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-07-07 19:59:31 -0400 |
| commit | 096ea59db20e729098066435ab5a8c4cfa01457d (patch) | |
| tree | 5120caa871bf069f007c18de31dbed85b60eb3ee | |
| parent | a28cdca28a6ce742ae9baabe6015c7afcebbf825 (diff) | |
| download | coinos-server-096ea59db20e729098066435ab5a8c4cfa01457d.tar.gz coinos-server-096ea59db20e729098066435ab5a8c4cfa01457d.zip | |
get user from key
| -rw-r--r-- | routes/lnurl.js | 6 |
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; |
