summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/CaptchaService.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2024-10-11 21:05:53 +0900
committerGitHub <noreply@github.com>2024-10-11 21:05:53 +0900
commitaf1cbc131fc9e045692f9f9def708c0978817fff (patch)
tree84143fc3e0d9a889a6005ddb62e08298087c8acf /packages/backend/src/core/CaptchaService.ts
parentchore: add description (diff)
downloadsharkey-af1cbc131fc9e045692f9f9def708c0978817fff.tar.gz
sharkey-af1cbc131fc9e045692f9f9def708c0978817fff.tar.bz2
sharkey-af1cbc131fc9e045692f9f9def708c0978817fff.zip
wip (#14745)
Diffstat (limited to 'packages/backend/src/core/CaptchaService.ts')
-rw-r--r--packages/backend/src/core/CaptchaService.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/backend/src/core/CaptchaService.ts b/packages/backend/src/core/CaptchaService.ts
index f6b7955cd2..206d0dbe0a 100644
--- a/packages/backend/src/core/CaptchaService.ts
+++ b/packages/backend/src/core/CaptchaService.ts
@@ -119,5 +119,18 @@ export class CaptchaService {
throw new Error(`turnstile-failed: ${errorCodes}`);
}
}
+
+ @bindThis
+ public async verifyTestcaptcha(response: string | null | undefined): Promise<void> {
+ if (response == null) {
+ throw new Error('testcaptcha-failed: no response provided');
+ }
+
+ const success = response === 'testcaptcha-passed';
+
+ if (!success) {
+ throw new Error('testcaptcha-failed');
+ }
+ }
}