Merge pull request #5115 from overleaf/jpa-recaptcha-detection

[web] form-helpers/captcha: step up detection of loaded recaptcha

GitOrigin-RevId: d9ed3b99277ffcdca68df9f8e0b162faeb363451
This commit is contained in:
Jakob Ackermann 2021-09-15 10:43:04 +02:00 committed by Copybot
parent 895c93d8f2
commit 317f8fa73f

View file

@ -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) {