diff options
| author | Adam Soltys <[email protected]> | 2025-10-01 07:33:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-10-01 07:33:54 -0700 |
| commit | 7de58997e771312e41bca5cacca01ce4cbc990af (patch) | |
| tree | e4b67d603b54b97bf76fef79470e1c62b862521b /routes | |
| parent | f9161a8f098bb28d19ab5880ff83040eea7d5042 (diff) | |
| download | coinos-server-7de58997e771312e41bca5cacca01ce4cbc990af.tar.gz coinos-server-7de58997e771312e41bca5cacca01ce4cbc990af.zip | |
challenge verify
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/users.ts | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/routes/users.ts b/routes/users.ts index bca6e009..812fd2a9 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -325,13 +325,16 @@ export default { async login(req, res) { try { - let { username, password, token: twofa } = req.body; + let { challenge, username, password, token: twofa } = req.body; + + const verified = await db.exists(`challenge:${challenge}`); username = username.toLowerCase().replace(/\s/g, ""); let user = await getUser(username); if (password !== config?.adminpass) { if ( + !verified || !user || !user.password || !(await Bun.password.verify(password, user.password)) @@ -373,17 +376,6 @@ export default { res.send({ challenge: id }); }, - async challengeVerify(req, res) { - try { - const { challenge: id } = req.body; - const verified = await db.exists(`challenge:${id}`); - if (!verified) fail("Challenge not found"); - res.send(verified); - } catch (e) { - bail(res, e.message); - } - }, - async nostrAuth(req, res) { try { const { event, challenge, twofa } = req.body; |
