Skip to content

artefactop/ecaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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