Skip to content

anton-johansson/vaadin-recaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Provides a simple Google reCAPTCHA v2 component for Vaadin.

Resources

License

Stars

Watchers

Forks

Packages

No packages published