diff options
| author | CyberRex <hspwinx86@gmail.com> | 2022-10-13 09:19:57 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-13 09:19:57 +0900 |
| commit | 1309367884197f4f4d94686fddfbd99fa20262bc (patch) | |
| tree | 3f21e60ee1bc155a903c403106fbdc6c0e0440b9 /packages/backend/src/server/api/SignupApiService.ts | |
| parent | add webhookId to api request (#9113) (diff) | |
| download | sharkey-1309367884197f4f4d94686fddfbd99fa20262bc.tar.gz sharkey-1309367884197f4f4d94686fddfbd99fa20262bc.tar.bz2 sharkey-1309367884197f4f4d94686fddfbd99fa20262bc.zip | |
Add Cloudflare Turnstile CAPTCHA support (#9111)
* Add Cloudflare Turnstile CAPTCHA support
* Update packages/client/src/components/MkCaptcha.vue
Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Diffstat (limited to 'packages/backend/src/server/api/SignupApiService.ts')
| -rw-r--r-- | packages/backend/src/server/api/SignupApiService.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts index 6552dac4bf..edb8e4e8e6 100644 --- a/packages/backend/src/server/api/SignupApiService.ts +++ b/packages/backend/src/server/api/SignupApiService.ts @@ -61,6 +61,12 @@ export class SignupApiService { ctx.throw(400, e); }); } + + if (instance.enableTurnstile && instance.turnstileSecretKey) { + await this.captchaService.verifyTurnstile(instance.turnstileSecretKey, body['turnstile-response']).catch(e => { + ctx.throw(400, e); + }); + } } const username = body['username']; |