Skip to content

Commit

Permalink
fix(single-captcha): use single captcha verification (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cali93 authored Dec 18, 2023
1 parent d7261a1 commit 782dc55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,13 @@ app.get('/health', async function (req, res) {
return res.status(200).json({ status: 'OK' })
})

app.post('/nonce', captchaVerification, async function (req, res) {
app.get('/nonce', async function (req, res) {
req.session.nonce = generateNonce()

return req.session.save(() => res.status(200).json({ nonce: req.session.nonce }))
})

app.post('/connect', captchaVerification, verifyAndSignIn)

app.post('/session', captchaVerification, async function (req, res) {
app.get('/session', async function (req, res) {
const siweSession = req.session.siwe
if (!siweSession) {
return res.status(401).json({ error: 'Unauthorized' })
Expand All @@ -126,6 +124,8 @@ app.post('/session', captchaVerification, async function (req, res) {
return res.status(200).json({ session: siweSession })
})

app.post('/connect', captchaVerification, verifyAndSignIn)

app.post('/disconnect', async function (req, res) {
res.clearCookie(COOKIE_NAME)
return req.session.destroy((err) => {
Expand Down

0 comments on commit 782dc55

Please sign in to comment.