Repository navigation
hCaptcha
oCMS includes an hCaptcha module to protect the login form, and public forms that have a captcha field, from automated attacks and bots.
hCaptcha is a privacy-focused CAPTCHA service that helps protect against:
- Automated brute force attacks
- Credential stuffing
- Bot registrations
- Spam submissions
- Visit hCaptcha Dashboard
- Create a free account
- Add your site and obtain your Site Key and Secret Key
- Navigate to Admin > Modules > hCaptcha
- Enter your Site Key and Secret Key
- Choose theme and size preferences
- Enable hCaptcha
- Click Save
OCMS_HCAPTCHA_SITE_KEY=your-site-key
OCMS_HCAPTCHA_SECRET_KEY=your-secret-keyEnvironment variables take precedence over database settings for the keys.
| Setting | Options | Description |
|---|---|---|
| Enabled | On/Off | Enable or disable hCaptcha protection |
| Site Key | String | Your hCaptcha public site key |
| Secret Key | String | Your hCaptcha secret key (masked in the admin interface) |
| Theme |
light / dark
|
Widget color theme |
| Size |
normal / compact
|
Widget size |
If the stored settings cannot be read at startup (a database error), hCaptcha is turned on wherever the environment keys are set, even if the stored settings had it off (OCMS_HCAPTCHA_DISABLED=true still wins), with the default theme and size. The settings page shows a warning while it displays this fallback and disables saving; a save is refused until the stored settings load (the module retries the load at most once a minute when it is next used; saving a form opened before the restart retries it at once), and a form rendered from the fallback is refused even after they recover. Without environment keys there is nothing to verify against, so protection is off until the settings load.
- When enabled, the hCaptcha widget appears on the login form and on public forms that have a captcha field
- Users must complete the CAPTCHA challenge before submitting
- The server verifies the response with hCaptcha's API
- Login proceeds only if verification succeeds
hCaptcha provides test keys for development. Set them yourself; they are not applied automatically:
| Key Type | Value |
|---|---|
| Site Key | 10000000-ffff-ffff-ffff-000000000001 |
| Secret Key | 0x0000000000000000000000000000000000000000 |
With test keys, the widget always passes automatically — no challenge is shown.
Go to Admin > Modules > hCaptcha and toggle it off.
# Disable at setting level (keeps module loaded)
sqlite3 ./data/ocms.db "UPDATE hcaptcha_settings SET enabled = 0"
# Disable at module level (prevents module from loading)
sqlite3 ./data/ocms.db "UPDATE modules SET is_active = 0 WHERE name = 'hcaptcha'"Restart the application after database changes.
hCaptcha works alongside the existing Login Security protection:
| Layer | Protection |
|---|---|
| 1. hCaptcha | Blocks bots before login attempt |
| 2. IP Rate Limiting | Limits requests per IP |
| 3. Account Lockout | Locks account after failed attempts |
For maximum security, enable all three layers.
| Error | Cause | Solution |
|---|---|---|
| "Please complete the captcha" | User didn't complete the challenge | Complete the hCaptcha widget |
| "Captcha verification failed. Please try again." | Network or API error, or the token was rejected by hCaptcha | Check internet connection, complete the challenge again |
Ensure your proxy passes the real client IP. See Reverse Proxy for configuration.
The module uses the client IP resolved by oCMS. Forwarding headers are honored only when the direct peer is listed in OCMS_TRUSTED_PROXIES; the order is:
-
X-Forwarded-For(the first address from the right that is not a trusted proxy) -
X-Real-IP, only whenX-Forwarded-Foris absent RemoteAddr
sqlite3 ./data/ocms.db "UPDATE hcaptcha_settings SET enabled = 0"
# Restart the application- Check that hCaptcha is enabled:
sqlite3 ./data/ocms.db "SELECT * FROM hcaptcha_settings" - Verify both Site Key and Secret Key are set
- Check browser console for JavaScript errors
- Ensure hCaptcha script can load (check firewall/ad blockers)
- Verify your Secret Key is correct
- Check server logs for error codes (
missing-input-secret,invalid-input-secret, etc.) - Ensure your server can reach
https://api.hcaptcha.com/siteverify
hCaptcha is designed with privacy in mind — GDPR compliant, does not sell personal data, and can operate without cookies. See hCaptcha Privacy Policy.
- Login Security — Rate limiting and account lockout
- Security — Full security overview
- Reverse Proxy — Proxy setup for correct IP detection
Getting Started
Core Features
- Content Management
- Media Library
- Taxonomy
- Menu Builder
- Forms
- Multi-Language
- SEO
- Feeds
- Video Embedding
- Agent-Ready
Administration
API & Integrations
Security
Theme Development
Module Development
Built-in Modules
- Module: Sentinel
- Module: Developer
- Module: DB Manager
- Module: Migrator
- Module: Informer
- Module: Demo Mode
- Module: Internal Analytics
- Module: External Analytics
- Module: Privacy
- Module: Embed
- Module: MCP Server
Deployment