Implement ALTCHA captcha service with challenge generation and solution verification
- Added AltchaService class for managing ALTCHA captcha challenges and solutions. - Created CaptchaController to handle API requests for generating challenges. - Introduced CaptchaGuard for validating captcha solutions on public endpoints. - Developed unit tests for AltchaService to ensure challenge creation and solution verification functionality. - Implemented integration tests for the Captcha API endpoint and captcha bypass behavior when disabled. - Added documentation for the Captcha API in the corresponding markdown file.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
> **Prefix:** `/api/v1/user` and `/oauth`
|
||||
> **Permission:** All endpoints in this module are **PUBLIC** (no JWT required) except `userinfo` and `logout`
|
||||
|
||||
> **🛡️ ALTCHA captcha:** وقتی `ALTCHA_ENABLED=true` است (در prod)، endpointهای `send-code`، `register`، `otp-login` و `reset-password` علاوه بر بدنهی خود، فیلد `altcha` (payload حلشدهی widget) را الزامی میکنند؛ در غیر این صورت `422` با کد `ERR_CAPTCHA_001` برمیگردد. جزئیات و مسیر challenge در [captcha.md](captcha.md).
|
||||
|
||||
---
|
||||
|
||||
## POST `/api/v1/user/send-code`
|
||||
@@ -548,6 +550,8 @@ Submit a pre-registration request (doctor or clinic). Public endpoint — no aut
|
||||
|
||||
**Permission:** Public
|
||||
|
||||
> **🛡️ ALTCHA:** وقتی `ALTCHA_ENABLED=true` است، فیلد `altcha` (payload حلشدهی widget) الزامی است؛ در غیر این صورت `422` با `ERR_CAPTCHA_001`. رجوع به [captcha.md](captcha.md).
|
||||
|
||||
### Request Body
|
||||
```json
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user