diff options
| author | Adam Soltys <[email protected]> | 2020-05-18 18:38:20 -0400 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-18 18:38:22 -0400 |
| commit | 5ba721a904fdd760d33924d40479129069c70a1e (patch) | |
| tree | 0b10540405196e92099fdbc908ce9f308e55ccb1 /routes/users.js | |
| parent | 8ffd969ff2f50af4116edb2050ae5c95e2af6f41 (diff) | |
| download | coinos-server-5ba721a904fdd760d33924d40479129069c70a1e.tar.gz coinos-server-5ba721a904fdd760d33924d40479129069c70a1e.zip | |
captcha score logging
Diffstat (limited to 'routes/users.js')
| -rw-r--r-- | routes/users.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routes/users.js b/routes/users.js index bc4debdf..f5c8df03 100644 --- a/routes/users.js +++ b/routes/users.js @@ -83,6 +83,7 @@ app.post("/register", async (req, res) => { let ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress; + let success, score; try { const url = `https://www.google.com/recaptcha/api/siteverify?secret=${config.captcha}&response=${user.token}&remoteip=${ip}`; let captcha = await axios.post( @@ -95,7 +96,7 @@ app.post("/register", async (req, res) => { { timeout: 1000 } ); - let { success, score } = captcha.data; + ({ success, score } = captcha.data); if (!success || score < 0.3) { l.warn("failed registration attempt", ip); @@ -157,7 +158,7 @@ app.post("/register", async (req, res) => { user = await getUser(user.username); res.send(pick(user, ...whitelist)); emit(user.username, "user", user); - l.info("new user", user.username, ip); + l.info("new user", user.username, ip, token, score); }); app.post("/disable2fa", auth, twofa, async (req, res) => { |
