aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/users.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/routes/users.js b/routes/users.js
index 59e9bcf2..cb3eb71f 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -171,9 +171,11 @@ app.post("/register", async (req, res) => {
const d = ip.split(".");
const numericIp = ((+d[0] * 256 + +d[1]) * 256 + +d[2]) * 256 + +d[3];
- user.ip = numericIp;
- const ipExists = await db.User.findOne({ where: { ip: numericIp } });
- if (!ipExists) await gift(user);
+ if (Number.isInteger(numericIp)) {
+ user.ip = numericIp;
+ const ipExists = await db.User.findOne({ where: { ip: numericIp } });
+ if (!ipExists) await gift(user);
+ }
user.account_id = account.id;
await user.save();