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.')); | |
} | |
}); | |
$A.enqueueAction(action); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment