-
-
Save jamigibbs/7ffda1db5abeb56744a827793a47f48b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* If a message was received not from the expected origin, let's bail. | |
*/ | |
if (event.origin !== hostURL){ | |
return; | |
} | |
/* | |
* Let's check for a recaptcha token and send back the result to our component. | |
*/ | |
if (event.data.action == "alohaCallingCAPTCHA"){ | |
var token = document.getElementById("g-recaptcha-response").value; | |
if (token == ""){ | |
parent.postMessage({ | |
action: "alohaCallingCAPTCHA", | |
alohaResponseCAPTCHA : "NOK" | |
}, hostURL); | |
} else { | |
parent.postMessage({ | |
action: "alohaCallingCAPTCHA", | |
alohaResponseCAPTCHA : "OK", | |
response: token | |
}, hostURL); | |
} | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment