Template tags to weakly obfuscate an email behind JavaScript or a CAPTCHA (a reCAPTCHA)
Project description
A simple Django app providing template tags that attempt to obfuscate raw e-mail addresses to make them ever so slightly more difficult to scrape.
To be less-obtrusive, JavaScript is used to translate mangled source into a normal e-mail address. If JavaScript is not present, the reCAPTCHA mailhide service is offered to deobfuscate the addresses.
Using images, LTR-RTL hacks, or forcing reCAPTCHA access might be better at keeping your address safe from bots, but it’s annoying for legitimate users. By using JavaScript, hopefully we can thwart some of the dumbest bots into farming someone else’s email address without much of a usability hit.
Quick start
In your Django’s settings:
Add 'mailmangler' to your INSTALLED_APPS.
Add MAILMANGLE_PUBLIC and MAILMANGLE_SECRET, with keys from the reCAPTCHA Mailhide API: <http://www.google.com/recaptcha/mailhide/apikey>, e.g.
MAILMANGLE_PUBLIC = 'your-key...==' MAILMANGLE_SECRET = '123789...abcd'
Load the tag library with {% load mailmangler %}
In the <head> of your template, add {% mailmangle_js %}
Pipe (filter) email addresses through mailmangle or mailmangle_linked, e.g.
{{ my_email_var|mailmangle }} {{ "alice@example.com"|mailmangle }} {{ "bob@example.net"|mailmangle_linked }}
will produce:
A JS obfuscated, unlinked string of whatever my_email_var was.
A JS obfuscated, unlinked string of “alice@example.com”
A JS obfuscated, string with mailto link of “bob@example.com”
If JS is not present, a reCAPTCHA mailhide link is available in <noscript> tags.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for django_mailmangler-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de3c56af3f65cad39e8fbc48d3ac7e2562f3945321c8b8f8d56301323e2d0947 |
|
MD5 | 7a1191edf170db3567832588904e27e4 |
|
BLAKE2b-256 | 47bbb5294ccfa295f3e7080c2d4cfc4a4e0439fbf2acb67346e3dbeb0bb65430 |