HTML::FormHandlerX::Field::noCAPTCHA - Google's noCAPTCHA reCAPTCHA for HTML::FormHandler
The following is example usage.
In your HTML::FormHandler subclass, "YourApp::HTML::Forms::YourForm":
has_field 'nocaptcha' => (
type=>'noCAPTCHA',
site_key=>'[YOUR SITE KEY]',
secret_key=>'[YOUR SECRET KEY]',
);
Example Catalyst controller:
my $form = YourApp::HTML::Forms::YourForm->new({ctx => $c});
my $params = $c->request->body_parameters;
if($form->process($c->req->body_parameters) {
## Do something with the form.
} else {
## Redisplay form and ask to try again.
}
Example Catalyst config:
__PACKAGE__->config(
'HTML::FormHandlerX::Field::noCAPTCHA' => {
site_key => '[YOUR SITE KEY]',
secret_key => '[YOUR SECRET KEY]',
},
);
Support for the following field options, over what is inherited from HTML::FormHandler::Field
Required. The site key you get when you create an account on https://www.google.com/recaptcha/
Required. The secret key you get when you create an account on https://www.google.com/recaptcha/
Optional. The color theme of the widget. Options are 'light ' or 'dark' (Default: light)
Optional. When true, includes the markup in the rendered html. (Default: false)
Optional. The user's IP address. Google states this is optional. If you are using catalyst and pass the context to the form, noCAPTCHA will use it by default.
Optional. URL to the Google API. Defaults to https://www.google.com/recaptcha/api/siteverify
Optional. Seconds to wait for Google API to respond. Default is 10 seconds.
Optional. Message to display if user answers captcha incorrectly. Default is "You've failed to prove your Humanity!"
Optional. Message to display if there was an issue with Google's API response. Default is "We've had trouble processing your request, please try again."
Optional. When passing catalyst context to HTML::FormHandler, uses this values as the key to lookup configurations for this package. Default is HTML::FormHandlerX::Field::noCAPTCHA
The following modules or resources may be of interest.
HTML::FormHandler Captcha::noCAPTCHA
Chuck Larson <[email protected]>
Copyright 2017, Chuck Larson <[email protected]>
This projects work sponsored by End Cap Software, LLC. http://www.endcapsoftware.com
Original work by John Napiorkowski <[email protected]>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.