From 782dc55855cd5382fbc273061a2db45091252f64 Mon Sep 17 00:00:00 2001 From: Cali <32299095+Cali93@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:21:38 +0700 Subject: [PATCH] fix(single-captcha): use single captcha verification (#19) --- src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index b9ff276..efd4270 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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' }) @@ -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) => {