/* | |
* 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