Skip to content

Instantly share code, notes, and snippets.

@jamigibbs jamigibbs/helper.js Secret
Last active Jun 12, 2019

Embed
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.'));
}
});
$A.enqueueAction(action);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.