He is talking about Magento1 because there no contacts in Magento2
Magento1 = contacts/index/post
Magento2 = contact/index/post
So contacts/index/post
is a controller contact form module :
contacts
= frontname,
index
= controllerName,
post
= postAction().
If you want to add you captcha, so it's happening in form.phtml
, you have nothing to do in controller.
To add GoogleRecaptcha in your contact form :
app/design/frontend/{package}/{themeName}/template/contacts/form.phtml
$sitekey ='site_key_here'; //you get it from googleRecaptcha V3
$secret ='secret_key_here'; //you get it from googleRecaptcha V3
...
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" onsubmit="return validateCaptcha()">
...
<div class="g-recaptcha" id="recaptcha" data-sitekey="<?php echo $sitekey; ?>"></div> <!-- Google CAPTCHA-->
<div id="error-g-captcha" style="display:none;"><?php echo $this->__('Please check the captcha validation !')?></div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
// captcha validation
function validateCaptcha() {
var v = grecaptcha.getResponse();
if(v.length == 0) {
jQuery('#error-g-captcha').show();
return false;
} else {
jQuery('#error-g-captcha').hide();
return true;
}
}
//]]>
</script>
app/design/frontend/{package}/{themeName}/layout/local.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
...
<reference name="head">
<action method="addItem"><type>external_js</type><name>https://www.google.com/recaptcha/api.js</name><params/></action>
</reference>
</default>
</layout>