Componette

Componette

Recaptcha

Recaptcha for Nette Framework 2.4+

Usage

NEON configuration

parameters:
    recaptcha:
        sitekey: ...
        secret: ...

Example

Add extension method:

/**
 * @param \Nette\Forms\Container
 * @param string
 * @param string
 * @param string
 * @return \App\UI\Forms\Controls\Recaptcha
 */
Container::extensionMethod('addRecaptcha', function (Container $form, $name = 'recaptcha', $caption = 'Recaptcha', $message = 'Recaptcha validation failed.') {
    return $form[$name] = new App\UI\Forms\Controls\Recaptcha($caption, $message);
});

Add input in form

$form = new Form($this, $name); // form must be attached to presenter
$form->addRecaptcha();

Latte template

{input recaptcha}

HTML

...
<script src="https://www.google.com/recaptcha/api.js"></script>
</body>
</html>

No release at this moment. Try to create first one.

Componette Componette felix@nette.org