WebRatio 5.1 gives you the chance to add a Captcha code control to the forms of your Web Project.
N.B. This article applies to WebRatio version from 5.1 to 6.0. Starting from WebRatio 6.1 the Validation Rule Framework has been revisited. See the The_Validation_Rule_Framework article for further details.
This is the definition of Captcha extracted from the Wikipedia.
"A CAPTCHA or Captcha is a type of challenge-response test used in computing to ensure that the response is not generated by a computer. The process usually involves one computer (a server) asking a user to complete a simple test which the computer is able to generate and grade. Because other computers are unable to solve the CAPTCHA, any user entering a correct solution is presumed to be human. Thus, it is sometimes described as a reverse Turing test, because it is administered by a machine and targeted to a human, in contrast to the standard Turing test that is typically administered by a human and targeted to a machine. A common type of CAPTCHA requires that the user type letters or digits from a distorted image that appears on the screen."
Let's see the steps necessary to add a Captcha code control to a form.
-
Open a Web Project (you can use the Acme Sample Project).
-
Create a Page and name it "Login".
-
Add an Entry Unit to the page and name it "Login"
-
Add two fields to the Entry Unit, the Username field (string) and the password field (password).
-
Add another field to the Entry Unit and name it "Control Code" (string).
-
Add a Validation Rule to the "Control Code" field and name it Capcha Code. In the Properties View choose "Captcha" as the Predicate.
-
Add a Login Unit outside the page and name it "Login"
-
Add a Link connecting the Entry Unit and the Login Unit and name it "Enter"
-
Add a KO Link connecting the Login Unit and the "Login" page.
|
|
In this way you obtained a login page in which there is the captcha control code. You can see an example of the result in the figure below.
It's also possible to customize the captcha code using different properties on the Validation Rule. To add a Property to the Validation Rule right click on the element and choose the Add Property command.
-
characters: it defines the characters list to be used by the captcha code (default is ABCDEFGHIJKLMNPQRSTUVWXYZ123456789). It's possible to choose only a subset of characters changing the value of this property (e.g use only numbers - 123456789).
-
minLength: it defines the minimum number of characters to be used to create the control code (default is 6). If this value is set to a higher one respect to the maxLength it is ignored.
-
maxLength: it defines the maximum number of characters to be used to create the control code (default is 6). If this value is set to a lower one respect to the minLength it is ignored.
-
minFontSize: it defines the minimum font size to be used in the control code (default is 20).
-
maxFontSize: it defines the maximum font size to be used in the control code (default is 35).
-
fontNames: it defines the list of the available font families. The list is pipe (|) separated (default is Arial|Tahoma|Verdana).
-
width: it defines the width of the control code container (default is 200).
-
height: it defines the height of the control code container (default is 50).
-
colorRanges: it defines the range of colors to be used to render the characters. It's expressed in RGB. It's composed by three couple of values (default is 0,100,0,100,0,100).
-
background: it defines the color of the control code backgroung. It's expressed in RGB (default value is 255,255,255).