diff options
| author | Adam Soltys <[email protected]> | 2023-01-08 07:22:23 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-08 07:22:23 +0000 |
| commit | 50548775d05d6ac3c14595f7564607dc028495b6 (patch) | |
| tree | 2298e532611f2d46919a7169f95a8ac45316c962 /lib/passport.js | |
| parent | fc22686471eac52ad0cf8b688310c6758b61fea4 (diff) | |
| download | coinos-server-50548775d05d6ac3c14595f7564607dc028495b6.tar.gz coinos-server-50548775d05d6ac3c14595f7564607dc028495b6.zip | |
prioritize uuid in jwt payload
Diffstat (limited to 'lib/passport.js')
| -rw-r--r-- | lib/passport.js | 5 |
1 files changed, 3 insertions, 2 deletions
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); |
