Login

Captcha Middleware (Template)

Author:
zeeg
Posted:
March 23, 2007
Language:
HTML/template
Version:
Not specified
Tags:
captcha anti-spam
Score:
4 (after 4 ratings)

A middleware we are using to stop "spam" on Curse. It makes the user fill in a captcha box whenever they submit a form unless a cookie is set (which expires by default after 6 hours)

See also the python script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{% load i18n %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ LANGUAGE_USED }}" xml:lang="{{ LANGUAGE_USED }}">
<head>
	<title>{% trans "Confirm Your Identity" %}</title>
	<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}mail/main.css" />
</head>

<body>
<div id="w">
	<div id="h">
		<a href="http://www.curse-gaming.com/" title="Curse Home"><img class="l" src="{{ STATIC_URL }}mail/logo.png" alt="logo" /></a>
		<h1>{% trans "Confirm Your Identity" %}</h1>
	</div>
	<div class="bl">
		<h2>Are you human?</h2>
		<form method="post" action=".">
		{% for field in post_data %}
		{% ifnotequal field.0 "captcha" %}<input type="hidden" name="{{ field.0|escape }}" value="{{ field.1|escape }}" />{% endifnotequal %}
		{% endfor %}
		<p><img src="/captcha/{{ random_num }}/?a=1" alt="Captcha Test" style="border: 2px solid #aaaaaa !important;"></p>
		<p>Please enter the text you see above. {% if error %}<strong style="color: red;">{{ error|join:", "|escape }}</strong>{% endif %}</p>
		<p>
			<label for="id_captcha">Text:</label><input type="text" class="vTextField" style="width: 280px;" id="id_captcha" name="captcha" value="{{ form.data.captcha|escape }}" /> <input type="submit" class="button" value="Confirm" />
		</p>
		</form>
		<h2>Why is this page needed?</h2>
		<p>
			Due to continuous use of our website through spam bots, spiders, and similar software, we now "test" all users at specified intervals to verify if they are human.
		</p>
		<p>
			If you don't wish to see this in the future please login and visit your <a href="/accounts/">account settings</a> to <strong>verify your account</strong>.
		</p>
	</div>
</div>
</body>
</html>

More like this

  1. Captcha Middleware by zeeg 8 years, 3 months ago
  2. captcha, verification code by dingdongquan 4 years, 6 months ago
  3. Include captchas from recaptcha.net by b23 7 years, 9 months ago
  4. simple guestbook by laxu 6 years, 10 months ago
  5. Mathematical Captcha by dogada 7 years, 6 months ago

Comments

Please login first before commenting.