invisible_captcha 1.0.1 → 1.1.0

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
  SHA256:
3
- metadata.gz: 94b48763b4a33702bf8ae5ceae26837ecc5cacc80b0468c96b3d12a9139c6904
4
- data.tar.gz: 21332f804ac7c39f0adc09b6b4039625ca76a864a0bf49f59ec63910e72c2ce6
3
+ metadata.gz: 0d931568dd6707074ae2b5f48f6a5552283d482a4d87f27b1c72852dfce3d9cb
4
+ data.tar.gz: 4e78f33d0a7c4be1a774de1e98e55d7fd2f7ff84e1a407d66a565c6e99779fa9
5
5
  SHA512:
6
- metadata.gz: 4fe27394a45989537bc521f0df1f6d5e16ff07342e5cfd351ef3034587a73647df3e41f53e1d701022d11205b4254e93502dfd6c5b83ff665dfe392a806a9d4a
7
- data.tar.gz: dc82b65bc789224723c4bac7c07df1a459b2bf22139e4c64a75b7ca907cb5d670e94919c4a9ffa373780b2ecc7deb2c81a5f4ad35fe01911a577453f8c152db3
6
+ metadata.gz: 3fbe8b6755bbc31fb26fbf9d71f01b7c9dbe919feaaaf12f78f86f7e53e93bb9f04f52c83469ea59840714908d834abf84625a542e7f55de2b7f0cd1d877986c
7
+ data.tar.gz: 380701e4ddf138445faafb293ed94fe368d58eb7d995d44b3f871362550d5c2bb27d537d00c04cdf89501bc951ab227d3fe7c721389ba1f163327f4d8093ced4
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ Gemfile.lock
8
8
  spec/dummy/log/*.log
9
9
  spec/dummy/tmp/
10
10
  .byebug_history
11
+ .DS_Store
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.0]
6
+
7
+ - New option `prepend: true` for the controller macro (#77)
8
+
5
9
  ## [1.0.1]
6
10
 
7
11
  - Fix naming issue with Ruby 2.7 (#65)
@@ -115,6 +119,7 @@ All notable changes to this project will be documented in this file.
115
119
 
116
120
  - First version of controller filters
117
121
 
122
+ [1.1.0]: https://github.com/markets/invisible_captcha/compare/v1.0.1...v1.1.0
118
123
  [1.0.1]: https://github.com/markets/invisible_captcha/compare/v1.0.0...v1.0.1
119
124
  [1.0.0]: https://github.com/markets/invisible_captcha/compare/v0.13.0...v1.0.0
120
125
  [0.13.0]: https://github.com/markets/invisible_captcha/compare/v0.12.2...v0.13.0
data/README.md CHANGED
@@ -55,9 +55,9 @@ class TopicsController < ApplicationController
55
55
 
56
56
  private
57
57
 
58
- def your_spam_callback_method
59
- redirect_to root_path
60
- end
58
+ def your_spam_callback_method
59
+ redirect_to root_path
60
+ end
61
61
  end
62
62
  ```
63
63
 
@@ -153,6 +153,7 @@ The `invisible_captcha` method accepts some options:
153
153
  - `timestamp_enabled`: enable/disable this technique at action level.
154
154
  - `on_timestamp_spam`: custom callback to be called when form submitted too quickly. The default action redirects to `:back` printing a warning in `flash[:error]`.
155
155
  - `timestamp_threshold`: custom threshold per controller/action. Overrides the global value for `InvisibleCaptcha.timestamp_threshold`.
156
+ - `prepend`: the spam detection will run in a `prepend_before_action` if `prepend: true`, otherwise will run in a `before_action`.
156
157
 
157
158
  ### View helpers options:
158
159
 
@@ -4,8 +4,14 @@ module InvisibleCaptcha
4
4
  module ControllerExt
5
5
  module ClassMethods
6
6
  def invisible_captcha(options = {})
7
- before_action(options) do
8
- detect_spam(options)
7
+ if options.key?(:prepend)
8
+ prepend_before_action(options) do
9
+ detect_spam(options)
10
+ end
11
+ else
12
+ before_action(options) do
13
+ detect_spam(options)
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InvisibleCaptcha
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invisible_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Anguera Insa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-17 00:00:00.000000000 Z
11
+ date: 2020-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails