recaptcha.js 536 B

1234567891011121314151617
  1. export default function showRecaptcha() {
  2. const captcha = document.getElementById('g-recaptcha');
  3. if (!captcha) return null;
  4. window.recaptchaCallback = response => {
  5. const captchaInput = document.getElementById('g-recaptcha-input');
  6. captchaInput.value = response;
  7. };
  8. if (!window.grecaptcha) {
  9. return setTimeout(() => showRecaptcha(captcha), 200);
  10. }
  11. return setTimeout(() => {
  12. if ((window, captcha, !captcha.childNodes.length)) {
  13. window.grecaptcha.render(captcha);
  14. }
  15. return null;
  16. }, 1000);
  17. }