From 02a43a310f6ad0cc9e9beccc26e51ab5b339e15f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 May 2022 16:47:14 +0900 Subject: [PATCH] =?UTF-8?q?CAPTCHA=E6=B1=82=E3=82=81=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=81=AF2fa=E8=AA=8D=E8=A8=BC=E3=81=8C=E7=84=A1=E5=8A=B9?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84=E3=82=8B=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=A0=E3=81=91=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2faのトークンは期限付きだから、CAPTCHA解いてる間に期限切れになる --- .../backend/src/server/api/private/signin.ts | 24 +++++++++---------- packages/client/src/components/signin.vue | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/backend/src/server/api/private/signin.ts b/packages/backend/src/server/api/private/signin.ts index e8b222a4d5..0024b8ce3e 100644 --- a/packages/backend/src/server/api/private/signin.ts +++ b/packages/backend/src/server/api/private/signin.ts @@ -20,18 +20,6 @@ export default async (ctx: Koa.Context) => { const instance = await fetchMeta(true); - if (instance.enableHcaptcha && instance.hcaptchaSecretKey) { - await verifyHcaptcha(instance.hcaptchaSecretKey, body['hcaptcha-response']).catch(e => { - ctx.throw(400, e); - }); - } - - if (instance.enableRecaptcha && instance.recaptchaSecretKey) { - await verifyRecaptcha(instance.recaptchaSecretKey, body['g-recaptcha-response']).catch(e => { - ctx.throw(400, e); - }); - } - const username = body['username']; const password = body['password']; const token = body['token']; @@ -96,6 +84,18 @@ export default async (ctx: Koa.Context) => { } if (!profile.twoFactorEnabled) { + if (instance.enableHcaptcha && instance.hcaptchaSecretKey) { + await verifyHcaptcha(instance.hcaptchaSecretKey, body['hcaptcha-response']).catch(e => { + ctx.throw(400, e); + }); + } + + if (instance.enableRecaptcha && instance.recaptchaSecretKey) { + await verifyRecaptcha(instance.recaptchaSecretKey, body['g-recaptcha-response']).catch(e => { + ctx.throw(400, e); + }); + } + if (same) { signin(ctx, user); return; diff --git a/packages/client/src/components/signin.vue b/packages/client/src/components/signin.vue index 4f88e1829c..d140e143d3 100644 --- a/packages/client/src/components/signin.vue +++ b/packages/client/src/components/signin.vue @@ -11,6 +11,8 @@ + + {{ signing ? $ts.loggingIn : $ts.login }}