Provides a simple Google reCAPTCHA v2 component for Vaadin.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main
.gitignore
.travis.yml
LICENSE
README.md
license_header.txt
pom.xml

README.md

Google reCAPTCHA 2 Component for Vaadin

Build Status Maven Central Javadoc License

Provides a simple Google reCAPTCHA v2 component for Vaadin. See https://developers.google.com/recaptcha/ for more information.

Usage

  1. Generate your reCAPTCHA keys on http://www.google.com/recaptcha/intro/index.html

  2. Include the artifact in your POM:

    <dependency>
    	<groupId>com.anton-johansson<groupId>
    	<artifactId>vaadin-recaptcha</artifactId>
    	<version>2.0.0</version>
    </dependency>
  3. Include the reCAPTCHA JavaScript in your UI:

    @JavaScript("https://www.google.com/recaptcha/api.js")
    public class CustomUI extends UI
    {
        ...
    }
  4. Add the Recaptcha-component to your UI:

    String siteKey = "...";
    String secretKey = "...";
    Recaptcha captcha = new Recaptcha(siteKey, secretKey);
    layout.addComponent(captcha);
  5. Optionally set extra properties on your component:

    captcha.setType(RecaptchaType.AUDIO);
    captcha.setTheme(RecaptchaTheme.DARK);
    captcha.setSize(RecaptchaSize.COMPACT);
  6. Validate the user input:

    if (!captcha.isVerified())
    {
        ...
    }

License

Apache License © Anton Johansson