Skip to content

Commit 623ea1c

Browse files
committed
add captcha plugin
1 parent 51113a2 commit 623ea1c

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

dev-demo/resources/adminuser.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import AdminForthAdapterGoogleOauth2 from '../../adapters/adminforth-oauth-adapt
1010
import OpenSignupPlugin from '../../plugins/adminforth-open-signup/index.js';
1111
import OAuthPlugin from '../../plugins/adminforth-oauth/index.js';
1212
import KeyValueAdapterRam from '../../adapters/adminforth-key-value-adapter-ram/index.js';
13+
import CaptchaAdapterCloudflare from "@adminforth/login-captcha-adapter-cloudflare";
14+
import CaptchaPlugin from "@adminforth/login-captcha";
15+
1316

1417
async function allowedForSuperAdmin({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
1518
return adminUser.dbUser.role === 'superadmin';
@@ -134,6 +137,12 @@ export default {
134137
}
135138
}
136139
),
140+
new CaptchaPlugin({
141+
captchaAdapter: new CaptchaAdapterCloudflare({
142+
siteKey: `${process.env.CLOUDFLARE_SITE_KEY}`, // Replace with your site key
143+
secretKey: `${process.env.CLOUDFLARE_SECRET_KEY}`, // Replace with your secret key
144+
}),
145+
}),
137146
new ForeignInlineListPlugin({
138147
foreignResourceId: 'cars_sl'
139148
}),

live-demo/app/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"@adminforth/image-generation-adapter-openai": "^1.0.7",
2828
"@adminforth/image-vision-adapter-openai": "^1.0.1",
2929
"@adminforth/import-export": "^1.4.6",
30+
"@adminforth/login-captcha": "^1.1.7",
31+
"@adminforth/login-captcha-adapter-cloudflare": "^1.0.16",
3032
"@adminforth/rich-editor": "^1.6.14",
3133
"@adminforth/storage-adapter-amazon-s3": "^1.0.11",
3234
"@adminforth/text-complete": "^1.8.9",

0 commit comments

Comments
 (0)