Skip to content

Commit b7cfa5c

Browse files
Paul Möldersdozoisch
authored andcommitted
[fixed] handle widgetId equal to 0
as zero is a valid widgetId
1 parent 29dc144 commit b7cfa5c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/recaptcha.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ const ReCAPTCHA = React.createClass({
2727
},
2828

2929
getValue() {
30-
if (this.props.grecaptcha && this.state.widgetId) {
30+
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
3131
return this.props.grecaptcha.getResponse(this.state.widgetId);
3232
}
3333
return null;
3434
},
3535

3636
reset() {
37-
if (this.props.grecaptcha && this.state.widgetId) {
37+
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
3838
this.props.grecaptcha.reset(this.state.widgetId);
3939
}
4040
},
@@ -48,8 +48,7 @@ const ReCAPTCHA = React.createClass({
4848
},
4949

5050
explicitRender(cb) {
51-
if (this.props.grecaptcha && !this.state.widgetId) {
52-
this.refs.captcha;
51+
if (this.props.grecaptcha && this.state.widgetId === undefined) {
5352
let id = this.props.grecaptcha.render(this.refs.captcha, {
5453
sitekey: this.props.sitekey,
5554
callback: this.props.onChange,

0 commit comments

Comments
 (0)