aboutsummaryrefslogtreecommitdiffstats
path: root/lib/passport.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-06 13:59:03 -0800
committerAdam Soltys <[email protected]>2023-01-06 13:59:03 -0800
commit8266d3adad8d093212b208ff93e6bee41f3370e3 (patch)
tree3325b0c9ae32b107603d0dac1bfa2c5493f8b458 /lib/passport.js
parentb1aa064c6f19946e0aac4fb79700f848c86faa4b (diff)
downloadcoinos-server-8266d3adad8d093212b208ff93e6bee41f3370e3.tar.gz
coinos-server-8266d3adad8d093212b208ff93e6bee41f3370e3.zip
locktime field, uuid for token
Diffstat (limited to 'lib/passport.js')
-rw-r--r--lib/passport.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/passport.js b/lib/passport.js
index ac2949a5..1244aab5 100644
--- a/lib/passport.js
+++ b/lib/passport.js
@@ -35,13 +35,19 @@ fastifyPassport.use(
},
async (payload, next) => {
try {
- let { username } = payload;
+ let { username, uuid } = payload;
+ let where = {};
+
+ if (username)
+ where.username = { [Op.or]: [username, username.replace(/ /g, "")] };
+
+ if (uuid) where.uuid = uuid;
+
let user = await db.User.findOne({
- where: {
- username: { [Op.or]: [username, username.replace(/ /g, "")] }
- },
+ where,
include: { model: db.Account, as: "account" }
});
+
if (user.locked) throw new Error("account is locked");
next(null, user);
} catch (e) {