Skip to content

Commit b80d8dd

Browse files
authored
Merge pull request #381 from devforth/AdminForth/873
docs: add docs for the captcha plugin and adapters
2 parents df40673 + 83d24e5 commit b80d8dd

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

adminforth/documentation/docs/tutorial/05-ListOfAdapters.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,24 @@ Pros:
186186
* Simplest in use - does not reqauire any external daemon.
187187
Cones:
188188
* In production sutable for single-process installations only
189+
190+
191+
## 🤖Captcha adapters
192+
193+
Used to add capthca to the login screen
194+
195+
[🔗Captcha adapter source class](https://github.com/devforth/adminforth/blob/65153408a119314dad339f452700e0937952034a/adminforth/types/adapters/CaptchaAdapter.ts#L5)
196+
197+
### Cloudflare adapter
198+
199+
```
200+
npm i @adminforth/login-captcha-adapter-cloudflare
201+
```
202+
203+
204+
### reCaptcha adapter
205+
206+
```
207+
npm i @adminforth/login-captcha-adapter-recaptcha
208+
```
209+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Login Captcha
2+
3+
(this plugin experemental and not yet fully tested)
4+
5+
This plugin provides a captcha for the login page to enhance security.
6+
7+
## Installation
8+
9+
To install the plugin, run the following command:
10+
11+
```bash
12+
npm i @adminforth/login-captcha
13+
```
14+
15+
You will also need to install a captcha adapter. For example, to use the Cloudflare adapter, run:
16+
17+
```bash
18+
npm i @adminforth/login-captcha-adapter-cloudflare
19+
```
20+
21+
## Usage
22+
23+
To use the plugin, add it to your user resource file. Here's an example:
24+
25+
```ts template="./resources/adminuser.ts"
26+
// Import the plugin and adapter
27+
import CaptchaPlugin from "@adminforth/login-captcha";
28+
import CaptchaAdapterCloudflare from "@adminforth/captcha-adapter-cloudflare";
29+
30+
...
31+
32+
// Add the plugin to the `plugins` array
33+
plugins: [
34+
new CaptchaPlugin({
35+
captchaAdapter: new CaptchaAdapterCloudflare({
36+
siteKey: "YOUR_SITE_KEY", // Replace with your site key
37+
secretKey: "YOUR_SECRET_KEY", // Replace with your secret key
38+
}),
39+
}),
40+
]
41+
```
42+
43+
## Result
44+
45+
After setting up the plugin, your login page will include a captcha. Below is an example of how it will look:
46+
47+
![Login Captcha Example](LoginCaptcha1.png)
57.3 KB
Loading

0 commit comments

Comments
 (0)