MyBB Community Forums

Full Version: reCAPTCHA v3 Contact Page Submission Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Issue:
When clicking submit on the Contact Us page users encounter an error stating they must solve the reCAPTCHA. However, reCAPTCHA v3 is invisible for website visitors. There are no challenges to solve. I am assuming that this is a bug that may have been overlooked and I haven't seen it reported here before (or my search terms are incorrect).

Error:
Please solve the reCAPTCHA to verify that you're not a robot.
which plugin? are you sure you enter keys right? because this mean one of your keys is not correct.
reCAPTCHA  has two keys , (website, secrect).
you do not have enter correctly or programmer load website key in client side and this key current not load correctly in your page. (For example, a plugin variable may have been deleted in your theme)
Not using a plugin. Its the mybb built in Contact Us page.

My reCAPTCHA works properly on registration and guest posting. This only occurs on the Contact Us page. So not sure how this would be a key issue.

Its not theme related, this has been tested on the default theme.
make sure {$captcha} is in your contact template.
and make sure your post_captcha_hcaptcha_invisible  template code is like this
<br />
<script src="{$server}?onload=captchaOnloadCallback&render=explicit" async defer></script>
<script type="text/javascript">

	var captchaTarget = '';

	var captchaOnSubmit = function(token) {

		if (!captchaTarget.is('#quick_reply_submit')) {
			document.createElement('form').submit.apply(captchaTarget.closest('form')[0]);
		}
		else {
			captchaTarget.on('click', function(e) {
				return Thread.quickReply(e);
			}).trigger('click').off('click');
			hcaptcha.remove();
		}

	};

	var captchaOnloadCallback = function() {

		captchaTarget = $('input[name="submit"], #quick_reply_submit').filter(function(){
			return $(this).closest('#quick_login').length == 0
		});

		captchaTarget.attr('data-size', 'invisible').unbind('click');

		hcaptcha.render(captchaTarget.get(0), {
				'sitekey': '{$public_key}',
				'callback': captchaOnSubmit
			}, true);

	}

</script>

and when you test let contact page load finished, then click on send button.
I've been testing this on the default theme so that everything is the original MyBB code. So all of these are untouched templates in my default theme. No changes have been made to them.

The contact page is completely loaded before I even start typing (no loading circle).