Introduction
Hi, today I am making a simple Guide on how to add a captcha system.
Needed components
For this tutorial, we will need the following components:
- - A canvas
- - A text box
- - A button
Generating a code
Add a canvas component to the screen and make it 80x210 pixels (height, width)
Set the line width to 4.
Set the paint color to #535252FE
and font size to 30.
Add a button as well as a textbox.
Change the button text to Verify
Set the textbox hint to Input code
Now, go to the blocks section.
We will start by adding random lines to the screen. Grab a Screen1.Initialize
block and put the following in it:
Now, from the block section change the color to black by adding this block:
Now, make a new variable and name it captchaText
:
Add the following blocks after Canvas1.Paint Color
, this will make a random generated code:
In the text input field, paste this:
A,B,C,D,E,F,G,H,I,J,K,L,K,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9
Now, after the for range loop add this block, this will write the code:
The Screen1.Initialize
blocks should look like this:
Checking the code
Checking if the code is correct is simple as 1,2,3.
Grab a Button.Click
event and make this:
Add the needed blocks up to your needs.
Result
The end blocks should look something like this:
Download
You can download the finished product here:
reCaptcha2.aia
reCaptcha2_Screen1.ais
reCaptcha2.apk
Feeling generous? Donate to me here: