summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/CaptchaService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/CaptchaService.ts')
-rw-r--r--packages/backend/src/core/CaptchaService.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/backend/src/core/CaptchaService.ts b/packages/backend/src/core/CaptchaService.ts
index b60271812c..0207cf58a0 100644
--- a/packages/backend/src/core/CaptchaService.ts
+++ b/packages/backend/src/core/CaptchaService.ts
@@ -3,6 +3,7 @@ import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
+import { bindThis } from '@/decorators.js';
type CaptchaResponse = {
success: boolean;
@@ -19,6 +20,7 @@ export class CaptchaService {
) {
}
+ @bindThis
private async getCaptchaResponse(url: string, secret: string, response: string): Promise<CaptchaResponse> {
const params = new URLSearchParams({
secret,
@@ -45,6 +47,7 @@ export class CaptchaService {
return await res.json() as CaptchaResponse;
}
+ @bindThis
public async verifyRecaptcha(secret: string, response: string | null | undefined): Promise<void> {
if (response == null) {
throw 'recaptcha-failed: no response provided';
@@ -60,6 +63,7 @@ export class CaptchaService {
}
}
+ @bindThis
public async verifyHcaptcha(secret: string, response: string | null | undefined): Promise<void> {
if (response == null) {
throw 'hcaptcha-failed: no response provided';
@@ -75,6 +79,7 @@ export class CaptchaService {
}
}
+ @bindThis
public async verifyTurnstile(secret: string, response: string | null | undefined): Promise<void> {
if (response == null) {
throw 'turnstile-failed: no response provided';