How to force recaptcha to expire your session?
I'm trying to make modifications with the recaptcha expiration message, but I can't see it (occasionally if I leave a tab open, it pops up), is there any way to force the recaptcha expiration callback?
In the case below the alert does not run because I do not know what time for it to be activated.
var onloadCallback = function() {
grecaptcha.render('g-recaptcha', {
'sitekey' : '6LcaNiwUAAAAAEdD5whzKq-9b1cXMlLexxBxcXhO',
'expired-callback' : expCallback
});
};
var expCallback = function() {
alert('ok');
};
1
1 answers
There is no way to force recaptcha to expire session, just render it after it expires.
Use a callback parameter using grecaptcha.reset()
For example:
Put this in the header.
<script>
var callback = function() {
grecaptcha.render('id-of-render-element', {
'sitekey': 'your-site-key',
'expired-callback': expCallback
});
};
var expCallback = function() {
grecaptcha.reset();
};
</script>
Put this after the element that will be used to render the reCAPTCHA.
<div id="id-of-render-element"></div>
<script src="https://www.google.com/recaptcha/api.js?onload=callback&render=explicit" async defer></script>
Source: https://stackoverflow.com/questions/28738949/fire-event-when-recaptcha-session-expires
0
Author: Henrique Araújo, 2017-08-25 19:32:25