Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captcha implementation #742

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Captcha implementation #742

wants to merge 3 commits into from

Conversation

haibeeb
Copy link
Contributor

@haibeeb haibeeb commented Mar 4, 2025

No description provided.

…otect the site from abusive scraping:

  1. Added hCaptcha integration with the necessary packages
  2. Created a captcha middleware that selectively applies CAPTCHA challenges to suspicious requests
  3. Added CAPTCHA widgets to search, entity, and dataset pages
  4. Implemented bot detection based on user agent, IP patterns, and query patterns
  5. Added styling for the CAPTCHA widget
  6. Updated the README with instructions for configuring hCaptcha

  To complete setup, you'll need to:
  1. Get hCaptcha keys from https://www.hcaptcha.com/
  2. Set the environment variables HCAPTCHA_SECRET and HCAPTCHA_SITEKEY
● The code is now clean and properly structured:

  1. Fixed bugs in the implementation:
    - Used the correct hCaptcha library and middleware pattern
    - Centralized CAPTCHA detection logic in app.js
    - Added proper form submission handling for CAPTCHA validation
  2. Made improvements to make the code more maintainable:
    - Added better UI for the CAPTCHA widget
    - Removed duplicate bot detection logic from individual controllers
    - Added proper styling for the CAPTCHA form
    - Fixed proper path handling for form submissions
  3. Verified code quality:
    - All files pass syntax checking
    - Server starts properly without errors

  The improved implementation now:
  - Selectively shows CAPTCHA challenges to suspicious traffic
  - Properly validates CAPTCHA responses on form submission
  - Is thoroughly documented in the README
  - Has a clean, consistent UI that matches the site's styling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant