A document has been updated:
http://cocoon.zones.apache.org/daisy/documentation/1294.html
Document ID: 1294
Branch: main
Language: default
Name: Captcha Widget (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 12/21/06 11:29:55 AM
Updated by: Helma van der Linden
A new version has been created, state: publish
Parts
=====
Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name: (unchanged)
Size: 2544 bytes (previous version: 2101 bytes)
Content diff:
<html>
<body>
--- <p> <!-- generate captcha image --><br/>
--- <map:match pattern="**/captcha-*.jpg"><br/>
--- <map:read type="captcha" src="{session-attr:captcha-{2}}"/>
--- <br/>
--- </map:match></p>
+++ <h2>Concept</h2>
--- <h1>Concept</h1>
---
<p>To prevent spammers from abusing forms, more and more sites are
including an
image that displays a distorted code. This is based on the CAPTCHA technique
(see also the <a href="daisy:686">CAPTCHA</a> block).</p>
<p>The Captcha widget provides a widget containing the generated image and
an
input field. The validation is only true if the input in the field matches
the
--- code displayed in the image.<br/>
--- The widget defines a session attribute with a name of <tt>captcha-<random
+++ code displayed in the image. Otherwise you will see a validation error.</p>
+++
+++ <p>The widget defines a session attribute with a name of
<tt>captcha-<random
id></tt> and a value containing a random code. The code is also added to
a
<tt>secret</tt> attribute of the widget for the validation phase. The image
has
the same name as the session attribute with a <tt>jpg</tt> extension.</p>
<h1>Definition</h1>
+++ <h2>Widget definition</h2>
+++
<p>The definition is simply:</p>
<pre><fd:captcha id="captchacheck" required="true">
(28 equal lines skipped)
<map:read type="captcha" src="{session-attr:captcha-{2}}"/>
</map:match></pre>
+++ <h1>Template</h1>
+++
+++ <p>Your template looks something like:</p>
+++
+++ <pre><table>
+++ ...
+++ <tr>
+++ <td class="label">
+++ <ft:widget-label id="captchacheck"/>
+++ </td>
+++ <td>
+++ <span
class="legend"><i18n:text>captcha-explanation</i18n:text></span>
+++ <br/>
+++ <ft:widget id="captchacheck"/>
+++ </td>
+++ </tr>
+++ ...
+++ </table></pre>
+++
+++ <p class="note">The image is marked with a <tt>captcha</tt> class. It is
useful
+++ to add a width (100px) and a height (50px) to your CSS file for this class,
to
+++ avoid display errors in Internet Explorer.</p>
+++
</body>
</html>