Skip to content

Commit bb9b01a

Browse files
authored
Merge pull request dozoisch#36 from bjab/master
Added support for "badge" attribute
2 parents aa64874 + 883210e commit bb9b01a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Other properties can be used to customised the rendering.
5858
| onExpired | func | *optional* callback when the challenge is expired and has to be redone by user. By default it will call the onChange with null to signify expired callback. |
5959
| stoken | string | *optional* set the stoken parameter, which allows the captcha to be used from different domains, see [reCAPTCHA secure-token] |
6060
| size | enum | *optional* `compact`, `normal` or `invisible`. This allows you to change the size or do an invisible captcha |
61+
| badge | enum | *optional* `bottomright`, `bottomleft` or `inline`. Positions reCAPTCHA badge |
6162

6263

6364
In order to translate the reCaptcha widget you should create a global variable configuring the desire language, if you don't provide it reCaptcha will pick up the user's interface language.

src/recaptcha.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ReCAPTCHA = React.createClass({
1212
onExpired: PropTypes.func,
1313
size: PropTypes.oneOf(["compact", "normal", "invisible"]),
1414
stoken: PropTypes.string,
15+
badge: PropTypes.oneOf(["bottomright", "bottomleft ", "inline"])
1516
},
1617

1718
getInitialState () {
@@ -24,6 +25,7 @@ const ReCAPTCHA = React.createClass({
2425
type: "image",
2526
tabindex: 0,
2627
size: "normal",
28+
badge: "bottomright"
2729
};
2830
},
2931

@@ -68,6 +70,7 @@ const ReCAPTCHA = React.createClass({
6870
"expired-callback": this.handleExpired,
6971
size: this.props.size,
7072
stoken: this.props.stoken,
73+
badge: this.props.badge
7174
});
7275
this.setState({
7376
widgetId: id,
@@ -86,7 +89,7 @@ const ReCAPTCHA = React.createClass({
8689
render () {
8790
// consume properties owned by the reCATPCHA, pass the rest to the div so the user can style it.
8891
/* eslint-disable no-unused-vars */
89-
const { sitekey, onChange, theme, type, tabindex, onExpired, size, stoken, grecaptcha, ...childProps } = this.props;
92+
const { sitekey, onChange, theme, type, tabindex, onExpired, size, stoken, grecaptcha, badge, ...childProps } = this.props;
9093
/* eslint-enable no-unused-vars */
9194
return (
9295
<div {...childProps} ref="captcha" />

0 commit comments

Comments
 (0)