Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.27 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.27 KB

ecaptcha

Build Status

Library for provide captchas

Dependencies

imagemagick

index


quickstart

To build the library and run tests

$ rebar get-deps compile
$ rebar eunit skip_deps=true

configuration

Copy the images used for captcha at priv/images, exist one special image for watermark watermark.png is required. Setup the images config at priv/captcha.config.

ecaptcha_image

new/2

-spec new(NumberElements::non_neg_integer(), Lang::binary()) -> list().

1> ecaptcha_image:new(2,<<"en">>).
[{<<"token">>, Token},{<<"text">>,<<"Where is Calamardo?">>},{<<"images">>,[Base64,Base64]}]

check/2

When a human select the an image, you check if is correct sending Token and the position selected of the images list.

-spec check(JWT::binary(), Position::non_neg_integer()) -> boolean().

1> ecaptcha_image:check(Token, 0).
true
2> ecaptcha_image:check(Token, 1).
false