ReCaptcha Integration

Apex allows you to easily take advantage of the popular Google noCaptcha reCaptcha, which allows you to help keep bots and spam at bay while users only need to click on a checkbox without having to decipher the characters on a scrambled image.

To add reCaptcha to any of the pages within the system, complete the following steps:

  1. Visit the Google reCaptcha API page, and obtain an API key-apir for your site. Within the Settings->General menu of the administration panel, enter your site and secret API keys in the first General tab.
  2. Within any of the TPL template files, simply place the <e:recaptcha> HTML tag. This will be replaced with the small widget that contains the checkbox users must click.
  3. Within your PHP code, authenticate reCaptcha by simply using the auth::recaptcha() function, which returns a boolean of true or false depending whether or not the user was verified.

Example

Again, within any TPL template file simply add the <e:recaptcha> tag. Then inside the proceeding PHP code, it will look something like:

namespace apex;

use apex\auth;
use apex\registry;
use apex\template;

if (!auth::recaptcha()) {
    template::add_message("Unable to verify that you are a human.  Please try again", 'error');
    registry::echo_template('previous_page');
}
  1. To add reCaptcha to your site, first sign up for a reCpatcha API key, and tner your site and secret API keys via the Settings->General Settings menu of the administraiton panel. within any of the TPL template files, simply add the <e:recaptcha> HTML tag, and it will be replaced with that small box containing a checkbox the user needs to click on. To authenticate within your