Skip to content

Commit

Permalink
Prepare 1.0.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
juban committed May 3, 2021
1 parent 186241f commit 0e0433e
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Google Recaptcha Changelog

## 1.0.4 - 2021-05-03
### Added
- Contact form instructions in README

### Changed
- Updated plugin icon

## 1.0.3 - 2021-05-01
### Changed
- Update docs, issues and changelog links in composer.json
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Google reCAPTCHA plugin for Craft CMS 3

![](logo.png)

Google reCAPTCHA for Craft CMS enables to render and validate the reCAPTCHA widget. It is compatible with both API v2 and v3, including checkbox badge and invisible flavors.

## Requirements
Expand Down Expand Up @@ -30,7 +32,7 @@ You can create a `google-recaptcha.php` file in the `config` folder of your proj

```php
return [
"version" => 2, // Either 2 or 3
"version" => 2, // Either 2 our 3
"siteKey" => '', // Site key
"secretKey" => '', // Secret key
"size" => 'normal', // normal, compact or invisible
Expand Down Expand Up @@ -103,7 +105,22 @@ Event::on(SaveController::class, SaveController::EVENT_BEFORE_SAVE_ENTRY, functi
});
```

### Verify Contact Form submissions

In order to add a reCAPTCHA verification when working with [Contact Form](https://plugins.craftcms.com/contact-form), you can do something like the following in a project module:

```php
Event::on(Submission::class, Submission::EVENT_AFTER_VALIDATE, function(Event $e) {
/** @var Submission $submission */
$submission = $e->sender;
// Check reCAPTCHA
$isValid = GoogleRecaptcha::$plugin->recaptcha->verify();
if (!$isValid) {
$submission->addError('recaptcha', 'Please, prove you’re not a robot.');
}
});

```

---

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "simplonprod/craft-google-recaptcha",
"description": "Google reCAPTCHA for Craft CMS",
"type": "craft-plugin",
"version": "1.0.3",
"version": "1.0.4",
"keywords": [
"craft",
"cms",
Expand Down
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0e0433e

Please sign in to comment.