From 317f8fa73f55527cb3df228f36950ea7315da7d4 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 15 Sep 2021 10:43:04 +0200 Subject: [PATCH] Merge pull request #5115 from overleaf/jpa-recaptcha-detection [web] form-helpers/captcha: step up detection of loaded recaptcha GitOrigin-RevId: d9ed3b99277ffcdca68df9f8e0b162faeb363451 --- .../web/frontend/js/features/form-helpers/captcha.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/form-helpers/captcha.js b/services/web/frontend/js/features/form-helpers/captcha.js index ed7f362268..1cce6ead31 100644 --- a/services/web/frontend/js/features/form-helpers/captcha.js +++ b/services/web/frontend/js/features/form-helpers/captcha.js @@ -4,7 +4,14 @@ let recaptchaId const recaptchaCallbacks = [] export async function validateCaptchaV2() { - if (typeof grecaptcha === 'undefined') { + if ( + // Detect blocked recaptcha + typeof grecaptcha === 'undefined' || + // Detect stubbed recaptcha + typeof grecaptcha.render !== 'function' || + typeof grecaptcha.execute !== 'function' || + typeof grecaptcha.reset !== 'function' + ) { return } if (recaptchaId === undefined) {