From b7cfa5cbfbb34113a1f3d6e81908069bdaa447df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20M=C3=B6lders?= Date: Fri, 6 Nov 2015 09:58:54 +0100 Subject: [PATCH] [fixed] handle widgetId equal to 0 as zero is a valid widgetId --- src/recaptcha.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/recaptcha.js b/src/recaptcha.js index 9bfaabc..b7d940e 100644 --- a/src/recaptcha.js +++ b/src/recaptcha.js @@ -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); } }, @@ -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,