Version 1 (modified by Felix Schwarz, 12 years ago) (diff)

New hack TracCaptchaPlugin, created by felix_schwarz



TracCaptcha is a trac plugin to embed a captcha in the ticket page in addition to Trac's regular permission checks so that spammers are kept out.

Batteries included: The popular reCAPTCHA system is supported out of the box. Technically it's a plugin - if you don't like it you're free to use any other plugin while still leverage the benefits from the general captcha infrastructure.

Does not annoy users: After the user entered the captcha once, he does not have to solve the captcha again for the same ticket when he just clicks 'preview'. Also you can configure exempt certain users or groups (e.g. 'all authenticated users') from the captchas just by using Trac's permission system.

Generic Infrastructure: TracCaptcha takes care about embedding a given captcha in the appropriate places which means that building a different captcha plugin is easy - you just have to build the captcha itself while this code will take care of the trac integration.

The whole code is licensed under the very liberal MIT license so you can use the API in your own code without problems.

Bugs/Feature Requests

Existing bugs and feature requests for TracCaptchaPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:traccaptchaplugin here].


You can check out TracCaptchaPlugin from here using Subversion, or browse the source with Trac.



Enable the macro in your trac.ini:

trac_captcha.* = enabled
# only needed if you want to use reCAPTCHA
trac_recaptcha.* = enabled

# add here the keys you got from
public_key = ...
private_key = ...

If you want to exempt some users from the captcha, grant them the CAPTCHA_SKIP privilege. TICKET_ADMINs and TRAC_ADMINs automatically have this privilege so they will never see a captcha. Also a user only needs to solve the captcha once per modification (so you can click 'preview' as often as you like without having to solve the captcha all over again).

Dependencies and Compatibility

  • Python 2.3-2.6
  • trac 0.11 or 0.12
  • optional: PyCrypto for better security on Python 2.3 and 2.4

Recent Changes

8162 by felix_schwarz on 2010-06-25 20:01:03
New hack TracCaptchaPlugin, created by felix_schwarz


Author: felix_schwarz
Maintainer: felix_schwarz

Attachments (1)

Download all attachments as: .zip