CAPTCHA: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Contents | |
| 2 | + | ||
| 3 | + | * 1 About | |
| 4 | + | * 1.1 Author | |
| 5 | + | * 1.2 License | |
| 6 | + | * 2 Description | |
| 7 | + | * 2.1 Methods | |
| 8 | + | * 2.2 Properties | |
| 9 | + | * 3 Installation | |
| 10 | + | * 3.1 Development version | |
| 11 | + | * 3.2 Release version | |
| 12 | + | ||
| 1 | 13 | ## About | |
| 2 | 14 | ||
| 3 | - | ||
| 15 | + | [](</File:CAPTCHA_simple_demo.png> "CAPTCHA simple demo") | |
| 4 | 16 | ||
| 5 | - | ||
| 17 | + | According to [wikipedia](<https://en.wikipedia.org/wiki/CAPTCHA>), _a**CAPTCHA** (a contrived acronym for "**C** ompletely **A** utomated **P** ublic **T** uring test to tell **C** omputers and **H** umans **A** part") is a type of challenge–response test used in computing to determine whether or not the user is human_. | |
| 6 | 18 | ||
| 19 | + | The component `TCaptchaLabel` allows to create a CAPTCHA to be used on any LCL form. It displays random characters which are colored and rotated and overlayed by colored lines to impede machine detection of the CAPTCHA text. | |
| 20 | + | ||
| 7 | 21 | ### Author | |
| 8 | 22 | ||
| 9 | - | ||
| 23 | + | Werner Pamler | |
| 10 | 24 | ||
| 11 | 25 | ### License | |
| 12 | 26 | ||
| 13 | - | ||
| 27 | + | Modified LGPL (with linking exception), like Lazarus LCL. See the file COPYING.modifiedLGPL.txt, included in the Lazarus distribution, for details about the license. | |
| 14 | 28 | ||
| 15 | 29 | ## Description | |
| 16 | 30 | ||
| 17 | - | ||
| 31 | + | `TCaptchaLabel` descends from `TGraphicControl` and contains its own drawing routine. Just place it on the form and use it. It displays a random string with rotated characters and overlaid lines. | |
| 18 | 32 | ||
| 19 | 33 | ### Methods | |
| 20 | 34 | ||
| 21 | - | ||
| 22 | - | ||
| 35 | + | * `**function** Verify(**const** AText: String): Boolean` \- Compares whether the user-provided string `AText` matches the CAPTCHA string and returns `true` in case of an agreement, or `false` otherwise. | |
| 36 | + | * `**procedure** NewCaptcha` \- Generates and displays a new CAPTCHA string | |
| 23 | 37 | ||
| 24 | 38 | ### Properties | |
| 25 | 39 | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 40 | + | * `Text: String` \- CAPTCHA string. The characters of the string are selected randomly from the `UpperCaseChars`, `LowerCaseChars`, `NumericChars` and/or `CustomChars`. | |
| 41 | + | * `NumChars: Integer` \- Number of characters in the CAPTCHA, i.e. length of `Text` | |
| 42 | + | * `NumLines: Integer` \- Number of lines drawn over the CAPTCHA | |
| 43 | + | * `Font1, Font2: TFont` \- Two fonts to be mixed within the CAPTCHA characters randomly | |
| 44 | + | * `MaxAngle: Integer` \- Maximum rotation angle (in degrees) for the characters which are rotated by a random angle between `-MaxAngle` and `+MaxAngle` | |
| 45 | + | * `Color: TColor` \- Background color of the area of the control covered by the CAPTCHA. Character and line colors are selected such that a minimum brightness difference to the background color is achieved. | |
| 46 | + | * `UpperCaseChars: String` \- Contains the characters among which upper-case characters in the CAPTCHA are selected randomly. UTF8 encoding is supported as usual (and like for the following strings) | |
| 47 | + | * `LowerCaseChars: String` \- Contains the characters among which lower-case characters in the CAPTCHA are selected randomly | |
| 48 | + | * `NumericChars: String` \- Contains the numeric characters characters for the CAPTCHA | |
| 49 | + | * `CustomChars: String` \- Contains non-alpha and non-numeric characters for the CAPTCHA | |
| 50 | + | * `Options: TCaptchaOptions` \- This is a set of the following enumerated options which can be combined: | |
| 51 | + | * `coAlphaUpper` \- Use upper-case characters as defined by the the `UppercaseChars` string | |
| 52 | + | Note: The characters which are hard to distinguish are skipped, O (upper-case o) vs 0 (zero), l (lower-case L) vs I (upper-case I) | |
| 53 | + | * `coAlphaLower` \- Use lower-case characters as defined by the `LowercaseChars` string | |
| 54 | + | * `coNumeric` \- Use numeric characters as defined by the `NumericChars` string | |
| 55 | + | * `coCustom` \- Use special characters as defined by the `CustomChars` string | |
| 56 | + | * `coRotated` \- Characters are rotated | |
| 57 | + | * `coFont1` \- Font1 is used | |
| 58 | + | * `coFont2` \- Font2 is used | |
| 59 | + | * `coLines` \- Lines are drawn over the CAPTCHA | |
| 60 | + | * `NewCaptchaEvent: TNewCaptchaEvent` \- Enumerated property which determines a short-cut how to create a new CAPTCHA string at runtime: | |
| 61 | + | * `nceNone` \- Feature is deactivated; CAPTCHA can only be changed by code. | |
| 62 | + | * `nceClick` \- A new CAPTCHA is created when the user clicks on the control | |
| 63 | + | * `nceDblClick` \- A new CAPTCHA is created when the user double-clicks on the control. | |
| 50 | 64 | ||
| 51 | 65 | ## Installation | |
| 52 | 66 | ||
| 53 | 67 | ### Development version | |
| 54 | 68 | ||
| 55 | - | ||
| 69 | + | The development version (aka trunk) is available at <https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/captcha/>. Download the package using svn or get the zipped _snapshot_ version. | |
| 56 | 70 | ||
| 57 | - | ||
| 71 | + | Load the package file **captcha_pkg.lpk** into the Lazarus Package Editor and click _"Use"_ > _"Install"_ to rebuild the Lazarus IDE. When Lazarus restarts you find the new component in the palette _"Misc"_. | |
| 58 | 72 | ||
| 59 | 73 | ### Release version | |
| 60 | 74 | ||
| 61 | - | ||
| 75 | + | The stable release version is distributed via the [[Online Package Manager|**Online-Package-Manager (OPM)**]]: Check the item "Captcha" in the OPM list, click "Install" and confirm the prompt to rebuild the IDE. | |
| 62 | 76 | ||
| 63 | 77 | --- | |
| 64 | - | ||
| 78 | + | *From the Free Pascal wiki, page "CAPTCHA", as the Internet Archive kept it on 2023-09-24. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
