This mod replaces TNG's Captcha, which uses Google reCaptchaV2, with Hcaptcha by modifing newacctform.php and suggest.php. Hcaptcha.php and hcapconfig.php files are copied to the TNG root folder. The behavior of Hcaptcha is similar to Google reCaptchaV2. This means only new account registrations and suggestions are protected. To protect additional TNG pages use Bot Manager with Hcaptcha.
Hcaptcha offers a high level of protection and the first 100,000 verifications, per thirty day period, are free. Before installing Hcaptcha, register your website domain and obtain API keys. API keys are the site key and secret key used to identify your website to Hcaptcha.
API keys for Hcaptcha are stored in a protected Hcaptcha_config.php file in the TNG root folder. When the mod is uninstalled the Hcaptcha_config.php file will remain in the TNG root folder. This allows installing, uninstalling and upgrading the mod without re-entering the site and secret keys.
When you register your website with Hcaptcha, you are given a secret key. This key is shown one time and cannot be retrieved once you leave that page. If you lose your secret key, you can generate a new one on the Hcaptcha website. Log in to the Hcaptcha dashboard and select the icon at the upper right of the page, then select settings. Here you will find a button to generate a new secret key. Store your secret key in a safe, secure place. It cannot be retrieved from Hcaptcha. You will also receive a site key which can be reteived at any time since site keys are public keys. However, site keys are useless without a matching secret key.
Information on the Hcaptcha pricing structure can be found at Hcaptcha Pricing.
Register your website and obtain site and secret keys at Hcaptcha Sign Up Options.
If you reach the free limit, Hcaptcha will return an error which does not allow the captcha challenge to be completed and denies access. This update adds an option to automatically disable the captcha when the limit is reached and then resume operation when the limit resets to zero. If email is enabled a message is sent stating the error type, the accessed URL and the client IP address. An Hcaptcha_alerts folder is created containing file entries for the error name, date and time it occurred. This file also prevents receiving excessive emails, if an error occurs, by limiting emails to one per hour.
Site and secret keys are stored in the Haptcha configuration file located in the TNG root folder. This upgrade protects against direct access using the URL.
Although not required, the optional code below can be used in the .htaccess file to add another layer of protection against external access.
DO NOT use this code to protect TNG file names used in the URL because it will deny access to everyone, including administrators.
<FilesMatch "hcapconfig\.php">
Require all denied
</FilesMatch>
Upload or copy the zip file contents, Hcaptcha cfg file and Hcaptcha folder, to the TNG mods folder. Click "OK to install" to expand the Hcaptcha mod section and then click Install. After the mod is installed there will be a message to enter the site key and secret keys in mod options. This is normal because the site key and secret key are entered after the mod is installed. If they are deleted, a message will indicate the keys are missing.
IMPORTANT While only one captcha should be installed at a time, Hcaptcha disables the Image Captcha Mod, if it is installed to prevent users from getting two captchas in succession.
If you use Bot Manager, uninstall it before proceeding. This upgrade requires Bot Manager version v15.0.2.11 and will not install with earlier versions.
Uninstall Hcaptcha and select delete, then delete the Hcaptcha folder from the mods folder, if Mod manager did not delete it. Upload the new version including the cfg file and Hcaptcha folder to the mods folder.
If a previous verision was installed, this upgrade will display a message to open the readme file to update the existing hcapconfig.php configuration file.
Select the Upgrade Configuration File button to update the existing hcapconfig.php file. Clicking the button more than once will not hurt anything.
IMPORTANT!!! - After updating, refresh the Mod Manager page to reload the updated file.
Update the Hcaptcha configuration file
Mod options will not appear unless the configuration file is updated and the Mod Manager page is refreshed to reload the updated configuration file.
ENTER THE HCAPTCHA SITE KEY: Enter the site key obtained from Hcaptcha.
ENTER THE HCAPTCHA SECRET KEY: Enter the secret key obtained from Hcaptcha.
ENTER THE HCAPTCHA THEME MODE: Enter either light or dark for the Hcaptcha notice background color.
ALLOW ACCESS ON HCAPTCHA ERROR: If the free limit is reached or an error occurs, setting this option to true allows unrestricted access until the free limit resets or the error is corrected.
SEND EMAIL ON HCAPTCHA ERROR: If the free limit is reached or an error occurs, enabling this option sends an email containing error information to the address specified.
ENTER YOUR EMAIL ADDRESS: Error messages will be sent to the email entered here using TNG email settings.
Select uninstall then select delete. Delete the Hcaptcha folder from the mods folder, if Mod Manager did not delete it.
Go to the TNG root folder and manually delete the protected hcapconfig.php file located in the TNG root folder.
To protect additional TNG pages install Bot Manager_v15.0.2.11. Bot Manager works with either Hcaptcha, Image Captcha or reCaptchaV2 and will load whichever captcha is installed to protect pages that load using tng_begin.php.
This update removes a install/uninstall conflict with the Add Attachement Link mod. While the protective functions are the same as earlier versions, additional messages aid in avoiding potential conflicts between captcha mods.