You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- It can display a Google Recaptcha v2 in any custom form with flexible settings and no affection to your existing code. Also works well for SilverStripe 4.x/3.x/2.x & Larave & Wordpress & other CMS.
6
+
- It can display a Google Recaptcha v2 or v3 in any custom form with flexible settings and no affection to your existing code. Also works well for SilverStripe 4.x/3.x/2.x & Larave & Wordpress & other CMS.
7
7
8
8
# Basic example codes
9
9
10
-
- Display Google Recaptcha after a Form_Field_ID:
10
+
- Display Google Recaptcha v2 or v3 after a Form_Field_ID:
- '\$GoogleRecaptchaSiteKey': The Google Recaptcha Site Key of your website. You can directly put site key here or a variable or from database.
55
-
- 'Form_ContactForm_Message': Form field id, via html code: ... `<input type="text" id="Form_ContactForm_Message" />` ... Your Google Recaptcha will display after this form field.
58
+
### Explain for above code:
59
+
- '\$SiteKey': The Google Recaptcha Site Key of your website. You can directly put site key here or a variable or from database.
60
+
- 'Form_ContactForm_Message': Form_Field_ID, via html code. eg. ... `<input type="text" id="Form_ContactForm_Message" />` ... Your Google Recaptcha will display after this form field.
56
61
- 'no_debug': Change to debug and not tick the I'm not a robot checkbox will continue submit the form, then you will see the failed message.
57
62
- 'mt-4 mb-1': Extra css class name for the Google Recaptcha area.
58
-
- 'Please tick the reCAPTCHA checkbox first': Frontend alert message if the end user does not tick the checkbox.
63
+
- 'Please tick the reCAPTCHA checkbox first': Frontend alert message if the end user does not tick the checkbox.**Tips:** You can change this value to "v3", it will automatically switch to use Google Recaptcha v3
59
64
- Default value of the parameters of the show() method
60
65
61
66
```php
62
67
show($site_key,$after_field_id='Form_ContactForm_Comment', $debug='no_debug', $extra_class="mt-4 mb-4", $please_tick_msg="Please tick the I'm not robot checkbox");
63
68
```
64
69
70
+
- Put below php code in your frontend template/page for **Google Recaptcha v3**
- Our Google Recaptcha v3 will automatically get g-recaptcha-response value after the page load 10 seconds or the Form_Field_ID(eg. Form_ContactForm_Message) was clicked.
79
+
- 'no_debug': Change to "debug" will always submit an empty g-recaptcha-response to the backend.
80
+
- 'show-inline-badge mt-4 mb-3': Extra css class name for the Google Recaptcha inline-badge. Remove show-inline-badge will show a right bottom float Recaptcha badge instead inline-badge.
- If you do not want to use the show() method, You can also use your own code to display the recaptcha for a custom style. Just make sure the form action method is POST, then you can still use below verify() method in your backend script.
66
85
67
86
# <aname="backend"></a>How to verify it in the backend script
0 commit comments