--- ABOUT HCAPTCHA ---

This mod modifies tng_begin.php and copies hcaptcha.php and hcapconfig.php files to the TNG root folder. The behavior of hcaptcha is the same as TNG Google reCaptcha. By default, TNG Captcha only affects new account registrations and suggestions.

Hcaptcha offers a high level of protection and the first 100,000 verifications 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. The site key will be listed on your hcaptcha dashboard page but the secret key is not. If you delete and lose the secret key hcaptcha cannot retrieve it.

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 with re-entering the site and secret keys.

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.

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 secret key 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.

Site and secret keys are stored in a configuration file in the TNG root folder. Try adding the code below to your .htaccess file to prevent external access to configuration files. Note that on some servers using Require local is sufficient while others may require using your host name or IP address.

# Block external access to TNG configuration files
<FilesMatch "config">
    Require all denied
    # code below for IPv4
    Require ip 127.0.0.0/8
    # code below for IPv6
    Require ip ::1
</FilesMatch>


--- INSTALLING THE MOD ---

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 Bot Manager mod section and then click Install. After the mod is installed there will be a message tp 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 display the keys are missing.

IMPORTANT While only one captcha shold be installed at a time, Hcaptcha will disable Image Captcha Mod if it is installed because Hcaptcha loads first. This prevents users from getting two captchas in succession.


--- EDIT OPTIONS ---

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.


--- UPGRADING THE MOD ---

To upgrade the mod uninstall Bot Manager, if it is installed. Then uninstall Hcaptcha and select delete. Delete the hcaptcha folder from the mods folder, if Mod manager did not delete it. Upload the new version which includes the cfg file and Hcaptcha folder then select install. Reinstall Bot Manager and reenter the access options. You do not need to re-enter the site and secret keys as they are stored in a separate protected file.


--- REMOVING THE MOD COMPLETELY ---

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.

--- ADDING BOT PROTECTION TO ADDITIONAL TNG PAGES ---

To protect additional TNG pages install Bot Manager. Bot Manager works with either hcaptcha, Image Captcha or reCaptcha V2 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 it functions the same as earlier versions, additional messages aid in avoiding potential conflicts between captcha mods.