rack-attack-recaptcha 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42e689dc0d03cdf5b116e1ab5ac3f723d053edf9
4
- data.tar.gz: 8876a9603be91f09dd608366ca341693b6195339
3
+ metadata.gz: 9055f29ff737aa2780619212a90152dcb21f0a16
4
+ data.tar.gz: 8b6907e03be3df56a6a89cbdf933b421103c808f
5
5
  SHA512:
6
- metadata.gz: d4b2d4fcf482dc6495cf50b17965d3f8948d1cc229c2024d60d8406e165a98f3b812a701152a288bb550bd25beee0c8bf8364a755a3ca11ce81324605d90b0fe
7
- data.tar.gz: f4ab497698bdabf287d794640158b51d7dc89523218188f509916c7994ab376568315e2489644eddb204038d454ac2f21ff8cf4149757eaf797af7b730a0eb30
6
+ metadata.gz: 1003c1bbf023f96ab708b61e678dc9200a2e94c30ddc075d03bfe5cc1086a8e8a9855a40c3e5d01e6e96a14223805b275afac59d4a3244bbe1495c8b01e06aa7
7
+ data.tar.gz: 7061f9f2763e09c072e37f82ed503b6126ad9dcf90b541d07c6405af7674c5ec58679f97ba48541004769c802625c5692cba56b0be306c758f3b2d447dc5b716
data/README.md CHANGED
@@ -28,15 +28,19 @@ And then execute:
28
28
 
29
29
  Tell your app to use the Rack::Attack middleware. For Rails 3+ apps:
30
30
 
31
- # In config/application.rb
32
- config.middleware.use Rack::Attack::Recaptcha
31
+ ```ruby
32
+ # In config/application.rb
33
+ config.middleware.use Rack::Attack::Recaptcha
34
+ ```
33
35
 
34
36
  To setup Recaptcha throttles, you should specify the throttle's type to
35
37
  be `:recaptcha` as shown here:
36
38
 
37
- Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second, :type => :recaptcha) do |req|
38
- req.ip
39
- end
39
+ ```ruby
40
+ Rack::Attack.throttle('req/ip', :limit => 5, :period => 1.second, :type => :recaptcha) do |req|
41
+ req.ip
42
+ end
43
+ ```
40
44
 
41
45
  Check out [rack-attack's](https://github.com/kickstarter/rack-attack)'s wiki for more details on setting throttles.
42
46
  To setup Recaptcha credentials, check out [recaptcha](http://github.com/ambethia/recaptcha)'s wiki.
@@ -48,28 +52,32 @@ you want the Recaptcha widget to appear.
48
52
 
49
53
  Example:
50
54
 
51
- # app/views/foos/foo.html.erb
55
+ ```ruby
56
+ # app/views/foos/foo.html.erb
52
57
 
53
- <%= form_for @foo do |f| %>
54
- # ... additional lines truncated for brevity ...
55
- <%= recaptcha_tags_if_under_attack %>
56
- # ... additional lines truncated for brevity ...
57
- <% end %>
58
+ <%= form_for @foo do |f| %>
59
+ # ... additional lines truncated for brevity ...
60
+ <%= recaptcha_tags_if_under_attack %>
61
+ # ... additional lines truncated for brevity ...
62
+ <% end %>
63
+ ```
58
64
 
59
65
  _(If the request is legit, `recaptcha_tags_if_under_attack` will render nothing.)_
60
66
 
61
67
  Now add `verify_recaptcha_if_under_attack` logic to each form action that you've
62
68
  protected:
63
69
 
64
- # app/controllers/foos_controller.rb
65
-
66
- def create
67
- if verify_recaptcha_if_under_attack && @foo.save
68
- # ...
69
- else
70
- # ...
71
- end
72
- end
70
+ ```ruby
71
+ # app/controllers/foos_controller.rb
72
+
73
+ def create
74
+ if verify_recaptcha_if_under_attack && @foo.save
75
+ # ...
76
+ else
77
+ # ...
78
+ end
79
+ end
80
+ ```
73
81
 
74
82
  _(If the request is legit,
75
83
  `verify_recaptcha_if_under_attack` won't actually check the captcha and
@@ -2,6 +2,7 @@ require "rack/attack"
2
2
  require "rack/attack/recaptcha/version"
3
3
  require "rack/attack/recaptcha/client_helper"
4
4
  require "rack/attack/recaptcha/verification_helper"
5
+ require "rack/attack/recaptcha/rails"
5
6
 
6
7
  module Rack
7
8
  class Attack
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  class Attack
3
3
  module Recaptcha
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-attack-recaptcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omer Lachish-Rauchwerger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-28 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler