Difference between revisions of "Google reCAPTCHA"

From WHMCS Documentation

Line 1: Line 1:
 
<div class="docs-alert-danger">
 
<div class="docs-alert-danger">
Google reCAPTCHA version 1 has been discontinued. Please refer to the [https://docs.whmcs.com/Google_reCAPTCHA#Migrating_to_Google_reCAPTCHA_v2 following section] of this page for more information on migrating to reCAPTCHA v2.
+
Google reCAPTCHA version 1 has been discontinued. Please refer to the [[Google_reCAPTCHA#Migrating_to_Google_reCAPTCHA_v2|following section]] of this page for more information on migrating to reCAPTCHA v2.
 
</div>
 
</div>
  
Line 56: Line 56:
 
[[File:Recaptcha_config.png]]
 
[[File:Recaptcha_config.png]]
  
More information regarding reCAPTCHA v2 can be found here: https://docs.whmcs.com/Google_No_CAPTCHA_reCAPTCHA for information on reCAPTCHA v2
+
More information regarding reCAPTCHA v2 can be found [[Google_No_CAPTCHA_reCAPTCHA|here]].

Revision as of 15:04, 13 June 2018

Google reCAPTCHA version 1 has been discontinued. Please refer to the following section of this page for more information on migrating to reCAPTCHA v2.

The following information is taken in part from here

Customizing the Look and Feel of reCAPTCHA

Theme

To make the reCAPTCHA widget display a different theme, you first need to add the following code in your main HTML page anywhere before the <form> element where reCAPTCHA appears. WHMCS would recommend placing this in the header.tpl file of your template just before the </head> tag.

{if $capatacha && $capatacha eq "recaptcha"}{literal}<script type="text/javascript">
 var RecaptchaOptions = {
    theme : 'theme_name'
 };
 </script>{/literal}{/if}

The 'theme_name' can be one of four pre-defined options

If you do not wish to use any of the default themes, you can create your own to match your site design. You can see how to do this @ Custom Theme. To use a custom theme, the theme variable must be set to 'custom'.

Language

By default, the language of the reCAPTCHA is English, however this can be customised to English (en), Dutch (nl), French (fr), German (de), Portuguese (pt), Russian (ru), Spanish (es) or Turkish (tr). To change the language, you need to add some javascript to define the language to your templates. This should be added to the pages you are using with captcha verification. To allow for multi-language environments, a language file variable is used to define the language:

{if $capatacha && $capatacha eq "recaptcha"}{literal}<script type="text/javascript">
 var RecaptchaOptions = {
    theme : 'theme_name',
    lang: '{/literal}{$LANG.isocode}{literal}'
 };
 </script>{/literal}{/if}

If your language is not one supported by Google, you are able to create your own translations. More information on this at https://developers.google.com/recaptcha/old/docs/customization#custom-translations

Migrating to Google reCAPTCHA v2

In WHMCS version 7.0 and above, we migrated to Google reCAPTCHA version 2, as version 1 was discontinued and no longer available. If a reCAPTCHA v1 is being displayed (now with a discontinued message), you should update your WHMCS installation and templates. You will also need to visit the Google reCaptcha site and generate new keys. To do that, follow these simple steps:

  1. Visit https://www.google.com/recaptcha/admin and log into your Google account if you're not already logged in with an active session.
  2. Under the section "Register a new site", enter in a label for your key and then select either the "reCAPTCHA v2" option, or for best forward compatibility select the "Invisible reCAPTCHA" option.

Captcha type.png

  1. Be sure to enter in your domain under the "domains" section and then accept the Google terms of service and click the Register button to finish registering your site and generating your keys.
  2. You should now be provided with a Site Key and a Secret Key to use with your WHMCS installation.

Recaptcha config.png

More information regarding reCAPTCHA v2 can be found here.