NAME
Mojolicious::Plugin::Captcha::reCAPTCHA - use Captcha::reCAPTCHA in Mojolicious apps
VERSION
version 0.03
SYNOPSIS
Provides a Captcha::reCAPTCHA object in your Mojolicious app.
use Mojolicious::Plugin::Captcha::reCAPTCHA;
sub startup {
my $self = shift;
$self->plugin('Captcha::reCAPTCHA', {
private_key => 'the_public_key',
public_key => 'your_private_key',
});
}
In your mojolicious controller you can control everything by yourself:
$self->stash(
recaptcha_html => $self->recaptcha->get_html( $public_key ),
);
and later
my $result = $self->recaptcha->check_answer(
$private_key,
$ip,
$value_of_challenge_field,
$value_of_response_field,
);
Or you can use the new helper:
METHODS/HELPERS
recaptcha
A helper named 'recaptcha' is created that can be used to get the recaptcha object.
my $recaptcha_obj = $self->recaptcha;
use_recaptcha
This helper sets the key "recaptcha_html" in the stash and uses the HTML as the value.
$self->use_recaptcha;
It uses the public key, you passed in the configuration.
validate_recaptcha
Handles the validation of the recaptcha. If an error occurs, the stash variable "recaptcha_error" is set.
$self->validate_recaptcha( $params );
$params is a hashref with parameters of the HTTP request.
AUTHORS
Renee Baecker <module@renee-baecker.de>
Heiko Jansen <jansen@hbz-nrw.de>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Hochschulbibliothekszentrum NRW (hbz).
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007