Skip to content

Instantly share code, notes, and snippets.

Last active Jun 12, 2019
What would you like to do?
doRecaptchaVerification: function(component, event, helper, token) {
const action = component.get('c.verifyResponse');
action.setParams({response: token});
action.setCallback(this, function(response) {
const state = response.getState();
if (state === 'SUCCESS') {
const valid = response.getReturnValue();
if (!valid) {
component.set('v.formMessage', 'Sorry, we could not verify you.');
} else if (valid) {
component.set('v.formMessage', '');
// reCaptcha validated! Here is where we'll submit the form.
} else {
const errors = response.getError();
component.set('v.formMessage', 'Sorry, an error occured.'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment