Shashank3736 / captcha-canvas

A captcha generator by using skia-canvas.
https://captcha-canvas.js.org
Apache License 2.0
61 stars 12 forks source link

Displaying undefined on 4 characters #43

Closed AshuInsideOut closed 2 years ago

AshuInsideOut commented 2 years ago

I tried to set the characters limit to 4 but it displays those 4 characters but also says undefined at the end.

const captcha = new Captcha(100, 100);
captcha.addDecoy().drawTrace().drawCaptcha({ characters: 4 });

image

Shashank3736 commented 2 years ago

Which version of captcha-canvas you are using right now?

AshuInsideOut commented 2 years ago

Version: 3.1.0

Shashank3736 commented 2 years ago

ok, issue is confirmed I will try to solve it today thank you for reporting this. For the time you can use CaptchaGenerator

AshuInsideOut commented 2 years ago

Okay, for the time being, I will use 6 characters and wait for the bug to be fixed. :)

Shashank3736 commented 2 years ago

To solve this problem you have to use drawCaptcha before addDecoy and drawTrace. So,

// wrong
const captcha = new Captcha(100, 100);
captcha.addDecoy().drawTrace().drawCaptcha({ characters: 4 });
// right
const captcha = new Captcha(100, 100);
captcha.drawCaptcha({ characters: 4 }).addDecoy().drawTrace();

Try this and let me know if you are still facing any problems.

Shashank3736 commented 2 years ago

New release v3.1.1 will solve your issue.

const captcha = new Captcha(100, 100, 4);
captcha.addDecoy().drawTrace().drawCaptcha();

This will create a captcha with 4 characters and also you can draw a captcha above the decoy and trace line.

AshuInsideOut commented 2 years ago

okay thanks

On Tue, Aug 9, 2022, 11:44 AM Shreyash Raj @.***> wrote:

New release v3.1.1 will solve your issue.

const captcha = new Captcha(100, 100, 4);captcha.addDecoy().drawTrace().drawCaptcha();

This will create a captcha with 4 characters and also you can draw a captcha above the decoy and trace line.

— Reply to this email directly, view it on GitHub https://github.com/Shashank3736/captcha-canvas/issues/43#issuecomment-1208958040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AODGOTXEECIHQAUDAZIVPMLVYHZLXANCNFSM5377URXQ . You are receiving this because you authored the thread.Message ID: @.***>

Shashank3736 commented 2 years ago

Let me know if your issue is resolved or not. If it is resolved then please close the issue