A clock image-based CAPTCHA service in the style of Google reCAPTCHA
git clone https://github.com/GonGe1018/ClockCAPTCHA.git
cd ClockCAPTCHA
uv synccp .env.example .env
nano .envpython main.pyThe server runs at http://localhost:8000! 🎉
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<form id="myForm">
<input name="email" placeholder="이메일" required>
<!-- ClockCAPTCHA widget -->
<script src="http://localhost:8000/api.js" async defer></script>
<div class="clock-captcha" data-sitekey="demo"></div>
<button type="submit">sumbit</button>
</form>
</body>
</html>import requests
def verify_captcha(token):
response = requests.post('http://localhost:8000/api/siteverify', {
'token': token
})
return response.json().get('success', False)
if verify_captcha(user_token):
# CAPTCHA passed - perform the actual task
save_user_data()
else:
# CAPTCHA failed - handle the error
return "CAPTCHA verification failed"| endpoint | method | description |
|---|---|---|
/demo |
GET | demo page |
/api.js |
GET | JavaScript client library |
/widget |
GET | CAPTCHA widget iframe |
/api/challenge |
GET | new CAPTCHA challenge generation |
/api/verify |
POST | user answer verify |
/api/siteverify |
POST | server token verify |
# Security Settings
JWT_SECRET_KEY=your-secret-key-change-this-in-production
JWT_ALGORITHM=HS256
CAPTCHA_EXPIRY_MINUTES=5
# Server Settings
HOST=0.0.0.0
PORT=8000
CORS_ORIGINS=*
CORS_CREDENTIALS=true
# AI Settings
GENERATED_IMAGES_DIR=generated_captchas
NOISE_INTENSITY=0.6
OUTPUT_SIZE_WIDTH=256
OUTPUT_SIZE_HEIGHT=256
GRAYSCALE=false- IllusionDiffusion: https://huggingface.co/spaces/AP123/IllusionDiffusion
MIT License
