Skip to content

Commit

Permalink
[fixed] handle widgetId equal to 0
Browse files Browse the repository at this point in the history
as zero is a valid widgetId
  • Loading branch information
Paul Mölders authored and dozoisch committed Nov 6, 2015
1 parent 29dc144 commit b7cfa5c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/recaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ const ReCAPTCHA = React.createClass({
},

getValue() {
if (this.props.grecaptcha && this.state.widgetId) {
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
return this.props.grecaptcha.getResponse(this.state.widgetId);
}
return null;
},

reset() {
if (this.props.grecaptcha && this.state.widgetId) {
if (this.props.grecaptcha && this.state.widgetId !== undefined) {
this.props.grecaptcha.reset(this.state.widgetId);
}
},
Expand All @@ -48,8 +48,7 @@ const ReCAPTCHA = React.createClass({
},

explicitRender(cb) {
if (this.props.grecaptcha && !this.state.widgetId) {
this.refs.captcha;
if (this.props.grecaptcha && this.state.widgetId === undefined) {
let id = this.props.grecaptcha.render(this.refs.captcha, {
sitekey: this.props.sitekey,
callback: this.props.onChange,
Expand Down

0 comments on commit b7cfa5c

Please sign in to comment.