diff options
| author | Adam Soltys <[email protected]> | 2020-05-19 18:12:23 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-19 18:12:23 -0700 |
| commit | c891dc49883d12bc53749779a537efabebc0a0e0 (patch) | |
| tree | 773720f3bd4489568a297cf29c6079acebf68ee9 | |
| parent | bf838e00b9ea38a3cb0a146e5de41086da155c13 (diff) | |
| download | coinos-server-c891dc49883d12bc53749779a537efabebc0a0e0.tar.gz coinos-server-c891dc49883d12bc53749779a537efabebc0a0e0.zip | |
test ip value
| -rw-r--r-- | routes/users.js | 8 |
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(); |
