reCaptcha system

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:

  • Untitled - A canvas
  • Untitled - A text box
  • Untitled - 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:
blocks (21)
Now, from the block section change the color to black by adding this block:
blocks (21)
Now, make a new variable and name it captchaText:
blocks (22)
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:
blocks (24)

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:

8 Likes

A nice guide​:+1:

I think you must not covert textbox text to upercase before comparing as captcha are case sensitive

2 Likes

That is true, what I am doing is if a user doesnt write in all caps it will still accept it, because the captcha here is not case sensitive :point_down:

A small mistake in these blocks. It should be Text1.Text not Button1.Text

2 Likes

Correct. I thought I changed it. Weird. I will correct it when I’m at home. The Aia and Apk are correct tho.

1 Like

It seems that this joke wasn’t funny but offensive.
Will be deleted.
Very very sorry.

1 Like

Hello, is there any way to clear text?

The “clear” mehod doesn’t work. Help me plz

@ontstudios clear text of the canvas, not textbox

TextBox1.Text = ""