dozoisch / dozoisch/react-google-recaptcha

Support for Enterprise Action names

Open
#289 1 comment 4 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

Since enterprise version is supported, how about adding support for the Enterprise Actions ?

Docs: https://cloud.google.com/recaptcha-enterprise/docs/actions-website .

Example (see data-action atribute) : https://developers.google.com/recaptcha/docs/v3.

I've already tested and its a easy change:

```
/src/recaptcha.js
```
```
explicitRender() {
const render = this.getCaptchaFunction("render");
if (render && this._widgetId === undefined) {

const wrapper = document.createElement("div");

wrapper.setAttribute("data-action", this.props.dataAction); // Change: Adding the atribute to the div, a new prop (dataAction) is necessary

this._widgetId = render(wrapper, {
sitekey: this.props.sitekey,
callback: this.handleChange,
theme: this.props.theme,
type: this.props.type,
tabindex: this.props.tabindex,
"expired-callback": this.handleExpired,
"error-callback": this.handleErrored,
size: this.props.size,
stoken: this.props.stoken,
hl: this.props.hl,
badge: this.props.badge,
isolated: this.props.isolated,
"data-action": this.props.dataAction, // Change: Pass the action also to the render
});
this.captcha.appendChild(wrapper);
}
...
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.