Magento 2 : Show captcha at contact us form
In order to add CAPTHA to a Contact Us form you have to go to Stores -> Configuration -> Customers -> Customers Configuration page and Enable CAPTCHA. Make sure to select Contact Us value in Forms field.
Once you update configuration, clean cache.
Hope it helps.
You can make a custom form template (based on the original) then you can load reCaptcha block programmatically whith this :
<?php
echo $block->getLayout()
->createBlock('MSP\ReCaptcha\Block\Frontend\ReCaptcha',
'msp-recaptcha',
['data' =>
[
'jsLayout' =>
[
'components' =>
[
'msp-recaptcha' =>
[
'component' => 'MSP_ReCaptcha/js/reCaptcha',
'zone' => 'contact'
]
]
]
]
]
)
->setTemplate('MSP_ReCaptcha::msp_recaptcha.phtml')
->toHtml();
?>