1.4.8 • Published 1 year ago

captcha-sveltekit v1.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

License Stars Forks Issues Contributors

Sveltekit Captcha

A highly customizable and simple to use Captcha component for SvelteKit.

Installation

npm install captcha-sveltekit

Usage

<script>
    import Captcha from 'captcha-sveltekit';
    const handleValidation = ({detail}) => {
        console.log(detail) //true or false
    }
</script>

<Captcha
    on:captcha-validation={handleValidation}
    //other options here
/>

Component Properties

optiontypedescriptiondefault
innerHTMLDivElementbinded to the general containerundefined until component is mounted
captcha_imageHTMLImageElementbinded to the image element of the captchaundefined until component is mounted
input_textHTMLInputElementbinded to the input element where user where user writes the captcha resultundefined until component is mounted
buttonHTMLButtonElementbinded to the button that triggers the captcha verificationundefined until component is mounted
captchastringthe string representing the captcha""
user_inputstringbinded to the value of the input_text""
char_amountnumberamount of characters to show in the captcha5
canvas_widthnumberwidth of the canvas/image345
canvas_heightnumberheight of the canvas/image96
background_colorstringbackground color of the canvas"#FFF"
fontstringfont used in the characters of the captcha"bold 30px Ubuntu"
font_colorstringcolor of the font used in the characters of the captcha"#777"
lines_colorstringcolor of the lines that strike through the captcha image"#777"
lines_amountnumberamount of lines in the captcha image20
captcha_altstringcaptcha image alt"CAPTCHA"
input_placeholderstringplaceholder of the input text"CAPTCHA"
button_textstringinner text of the button"Check"
case_sensitive_captchabooleanwether or not the captcha is case sensitive to the user inputtrue
use_random_font_colorsbooleanwether or not use random colors for each captcha character, if true, overwrites the font_color optionfalse
use_random_line_colorsbooleanwether or not use random colors for each line, if true, overwrites the lines_color optionfalse
autocheck_user_inputbooleanwether or not to check automatically if user input is same as the captcha, if true hides the check buttonfalse
auto_disapearbooleanwether or not auto hide the captcha once is completedtrue

Events

  • captcha-validation
    • if autocheck_user_input is false, is dispatched when check button is clicked, the detail might be true or false, depending on whether user_input is correct or not
    • if autocheck_user_input is true, is dispatched when user_input has same lenght as captcha and user_input is correct, the detail will be always true in this case

Screenshots

default values

screenshot 1

autocheck_user_input=true

screenshot 2

use_random_font_colors=true

screenshot 3

use_random_font_colors=true; use_random_line_colors=true

screenshot 3

char_amount=10; line_amount=5; font='Italic 30px Arial'

screenshot 3

Licence

MIT licensed

1.4.8

1 year ago

1.4.7

1 year ago

1.4.6

1 year ago

1.4.5

1 year ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.3.12

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.0

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago