Mojolicious-Plugin-Captcha-reCAPTCHA

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN

    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an

lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm  view on Meta::CPAN

            }
            if ( !defined $options ) {
                $options = $self->app->recaptcha_options;
            }
            return Mojo::ByteStream->new(
				$self->recaptcha->get_html( $self->app->recaptcha_public_key, $err, $use_ssl, $options )
			);
        }
    );
    $app->helper(
        validate_recaptcha => sub {
            my ( $self, $params ) = @_;

            my $result = $self->recaptcha->check_answer( $self->app->recaptcha_private_key,
                                                         $self->tx->remote_address,
                                                         $params->{recaptcha_challenge_field},
                                                         $params->{recaptcha_response_field},
            );

            if ( !$result->{is_valid} ) {
                $self->stash( recaptcha_error => $result->{error} );

lib/Mojolicious/Plugin/Captcha/reCAPTCHA.pm  view on Meta::CPAN

is automatically determined based on the current request (by looking at 
C<$self-\>req-\>url-\>base-\>scheme>). 

=head2 recaptcha_html

This helper works like C<use_recaptcha> but returns the HTML instead of setting a stash
value. Also accepts the same params as C<use_recaptcha()>.

Intended to be used in templates.

=head2 validate_recaptcha

Handles the validation of the recaptcha. If an error occurs, the stash variable
"recaptcha_error" is set.

  $self->validate_recaptcha( $params );

C<$params> is a hashref with parameters of the HTTP request.
Returns "true" (1) if validation was successful and "false" (0) otherwise.

=head1 AUTHORS

=over 4

=item *



( run in 4.234 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )