turnstiled 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -16
- data/lib/turnstiled/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed188fe3df0cb80cc0c7dccd9d16f757c911997357c3e203588cfb4b6a9034bd
|
4
|
+
data.tar.gz: 156a94a657896e935cd94dcdb03a1172838697fe078f2caa2dd57e96410926ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0483bcfdf269c1bd3a3a03d28487d191f689cc3144269383330b6266a62e5290ab9dbbf1295b9e74f453df3a6162d88651656a59c5b991cba6a415c53472447d'
|
7
|
+
data.tar.gz: d5011bde496d6bd7578dbfaff2d830c25acd3309bc9b4f793045ec3f627fe3f7a7f725ecaa1086c65454ecd7e25e34078c643df7732541dd5fd4606e5f1d81fc
|
data/README.md
CHANGED
@@ -1,28 +1,54 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Turnstiled
|
2
|
+
==========
|
3
3
|
|
4
|
-
|
5
|
-
How to use my plugin.
|
4
|
+
Turnstiled makes it easy to add the Cloudflare Turnstile Captcha to your Rails app.
|
6
5
|
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
6
|
+
For development, it even inlucdes a Mock widget.
|
9
7
|
|
10
|
-
|
8
|
+
Getting Usage
|
9
|
+
-------------
|
10
|
+
|
11
|
+
### Installation
|
12
|
+
|
13
|
+
First install the gem by adding this line to your application's Gemfile:
|
14
|
+
|
15
|
+
``` ruby
|
11
16
|
gem "turnstiled"
|
12
17
|
```
|
13
18
|
|
14
|
-
And
|
15
|
-
|
19
|
+
And executing:
|
20
|
+
|
21
|
+
``` bash
|
16
22
|
$ bundle
|
17
23
|
```
|
18
24
|
|
19
|
-
|
20
|
-
|
21
|
-
|
25
|
+
### Configuration
|
26
|
+
|
27
|
+
Create a file called `config/initializers/turnstiled.rb` and add the following:
|
28
|
+
|
29
|
+
``` ruby
|
30
|
+
Turnstiled.configure do |config|
|
31
|
+
config.api_key = "YOUR_API_KEY"
|
32
|
+
config.api_secret = "YOUR_API_SECRET"
|
33
|
+
end
|
22
34
|
```
|
23
35
|
|
24
|
-
|
25
|
-
|
36
|
+
In your layout, add the widget to the head of the document:
|
37
|
+
|
38
|
+
``` erb
|
39
|
+
<%= turnstiled_javascript_tag %>
|
40
|
+
```
|
41
|
+
|
42
|
+
In test and development, it will include a mock widget that fires the callback after 2 seconds.
|
43
|
+
|
44
|
+
The mock widget will send the `cf-turnstile-response` parameter with a value of `1`.
|
45
|
+
|
46
|
+
In your controller, you also need to verify the response with the following:
|
47
|
+
|
48
|
+
``` ruby
|
49
|
+
class PostsController < ApplicationController
|
50
|
+
verify_turnstile_requwst only: %i[create]
|
51
|
+
end
|
52
|
+
```
|
26
53
|
|
27
|
-
|
28
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
54
|
+
The `verify_turnstile_requwst` takes the same options as a `before_action` method call.
|
data/lib/turnstiled/version.rb
CHANGED