Dancer::Plugin::reCAPTCHA - Easily integrate reCAPTCHA into your Dancer applications
version 0.91
# In your config.yml plugins: reCAPTCHA: public_key: "public key goes here" private_key: "private key goes here" theme: "dark" type: "image" size: "normal" # In your Dancer app... use Dancer::Plugin::reCAPTCHA; # In your form display route... return template 'accounts/create', { recaptcha => recaptcha_display(), }; # In your template (TT2) [% recaptcha %] # In your validation code.... my $response = param( 'recaptcha_response_field' ); my $result = recaptcha_check( $response ); die "User didn't match the CAPTCHA" unless $result->{ success };
Generates the HTML needed to display the CAPTCHA. This HTML is returned as a scalar value, and can easily be plugged into the template system of your choice.
Using Template Toolkit as an example, this might look like:
# Code return template 'accounts/create', { recaptcha => recaptcha_display(), }; # In your accounts/create template [% recaptcha %]
Verify that the value the user entered matches what's in the CAPTCHA. This methods takes an argument that is the response string. These are returned to your Dancer application as the parameter g-recaptcha-response .
For example:
my $response = param( 'g-recaptcha-response' ); my $result = recaptcha_check( $response ); die "User didn't match the CAPTCHA" unless $result->{ success };
See Captcha::reCAPTCHA::V2 for a description of the result hash.
Add a real test suite.
The following people have contributes to Dancer::Plugin::reCAPTCHA in some way, either through bug reports, code, suggestions, or moral support:
Dancer::Plugin::reCAPTCHA
Mohammad S Anwar Shawn Sorichetti
Captcha::reCAPTCHA::V2
Dancer::Plugin
Dancer
Jason A. Crome <cromedome@gmail.com>
This software is copyright (c) 2014 by Jason A. Crome.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dancer::Plugin::reCAPTCHA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Plugin::reCAPTCHA
CPAN shell
perl -MCPAN -e shell install Dancer::Plugin::reCAPTCHA
For more information on module installation, please visit the detailed CPAN module installation guide.