Any example how to implement captcha?

Need to have a few public forms and need to protect them with captcha has anyone done this before?

Hello!

As starting point take a look at Vaadin add-on: ReCaptcha - Vaadin Add-on Directory.

is there a jmix example?

There is no Jmix example with ReCaptcha. Just add dependency to your build.gradle:

implementation 'com.wcs.wcslib:wcslib-vaadin-widget-recaptcha:2.0.3'

And Vaadin addons repository:

repositories {
    ...
    maven {
        url 'https://maven.vaadin.com/vaadin-addons'
    }
}

And in the screen add component:

@Autowired
private HBoxLayout captchaBox;

@Subscribe
public void onInit(final InitEvent event) {
    ReCaptcha captcha = new ReCaptcha(
            "your_private_key",
            new ReCaptchaOptions() {{ //your options
                theme = "light";
                sitekey = "your_public_key";
            }}
    );
    captchaBox.unwrap(JmixHorizontalActionsLayout.class).addComponent(captcha);
}

Also, see Google reCAPTCHA how to create keys.

Is this posible to get an example using Flow UI?

1 Like