Skip to content

Instantly share code, notes, and snippets.

@jamigibbs
Last active June 12, 2019 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamigibbs/82063f603647d59d607efb34ee9312be to your computer and use it in GitHub Desktop.
Save jamigibbs/82063f603647d59d607efb34ee9312be to your computer and use it in GitHub Desktop.
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