captcha-canvas icon indicating copy to clipboard operation
captcha-canvas copied to clipboard

feature request: setCaptcha support to pass SetCaptchaOption array

Open joyexpr opened this issue 2 years ago • 5 comments

feature request: setCaptcha support to pass SetCaptchaOption array, for now, only can pass one SetCaptchaOption

for example, I want generate a captcha: "abcd", and "ab" is red, "cd" is green

joyexpr avatar Aug 29 '22 03:08 joyexpr

Can you elaborate on the request? Like what you actually want, a feature to customise each character of a captcha.

Shashank3736 avatar Aug 30 '22 04:08 Shashank3736

if so, I can let user to enter the specified character, for example:

  1. please enter the red characters
  2. please enter the biggest 2 characters many many possibilities

joyexpr avatar Sep 01 '22 03:09 joyexpr

Hmm... make sense I will try to add this feature

Shashank3736 avatar Sep 03 '22 03:09 Shashank3736

by the way, is it a bug in captcha.ts:

if (option.colors && option.colors?.length > 2) {this._ctx.fillStyle = option.colors[getRandom(option.colors.length - 1)];}

should it be:

if (option.colors && option.colors?.length >= 2)  

joyexpr avatar Sep 03 '22 09:09 joyexpr

by the way, is it a bug in captcha.ts:

if (option.colors && option.colors?.length > 2) {this._ctx.fillStyle = option.colors[getRandom(option.colors.length - 1)];}

should it be:

if (option.colors && option.colors?.length >= 2)  

Yupp it is a bug. Actually I never use option.colors so I never noticed it. Thank you for raising it 😅

Shashank3736 avatar Jan 10 '23 10:01 Shashank3736