Recaptcha breaks after an expiration event
- Load page
- Check box
- Wait for expiration
- Try to click the box again or reset it manually
- Error inside the recaptcha script:
Any ideas if something related to the async script loading might be causing this? I've tried specifying an expiration callback as well but it behaves the same. Once it expires the recaptcha is unusable until the page is refreshed.
I was able to work around this by completely removing and rebuilding the component on expiration, so if this is Google's fault then this can be closed.
I'll look into it
For me, the error was "TypeError: this is undefined" at
if (this.props.onExpired) {
this.props.onExpired();
} else if (this.props.onChange) {
this.props.onChange(null);
}
};
Hey! As I also encountered some issues with this lib and couldn't solve it in a clean way so I decided to create my own library. It has some improvements comparing to this and most important - it works completely fine! 🚀 And what's most awesome - it's more a React-way of doing things, without assigning variables outside the component. Handling expiration event works pretty fine - I'm fresh after testing it. Check it out on the example page if you're interested 😄
Library: https://github.com/sarneeh/reaptcha Example: https://sarneeh.github.io/reaptcha/