panmind-recaptcha 1.0 → 1.0.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.
- data/README.md +2 -2
- data/Rakefile +5 -5
- data/lib/panmind/recaptcha/railtie.rb +25 -0
- data/lib/panmind/recaptcha.rb +9 -6
- data/rails/init.rb +1 -6
- metadata +38 -53
data/README.md
CHANGED
@@ -30,7 +30,7 @@ Via RubyGems:
|
|
30
30
|
|
31
31
|
Or via Rails Plugin:
|
32
32
|
|
33
|
-
|
33
|
+
rails plugin install git://github.com/Panmind/recaptcha.git
|
34
34
|
|
35
35
|
Usage
|
36
36
|
-----
|
@@ -140,5 +140,5 @@ there is no way to bypass the captcha when AJAX validation is enabled.
|
|
140
140
|
Compatibility
|
141
141
|
-------------
|
142
142
|
|
143
|
-
Tested with Rails
|
143
|
+
Tested with Rails 3.0.3 running under Ruby 1.9.2p0.
|
144
144
|
running under Ruby 1.9.1-p378.
|
data/Rakefile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/rdoctask'
|
3
3
|
|
4
|
-
require 'lib/panmind/recaptcha'
|
4
|
+
require './lib/panmind/recaptcha'
|
5
5
|
|
6
6
|
begin
|
7
7
|
require 'jeweler'
|
@@ -14,8 +14,8 @@ begin
|
|
14
14
|
'with the HTTP API for captcha verification, a DSL to generate a ' \
|
15
15
|
'before_filter and the code to implement AJAX captcha validation.'
|
16
16
|
|
17
|
-
gemspec.authors = ['Marcello Barnaba']
|
18
|
-
gemspec.email = 'vjt@openssl.it'
|
17
|
+
gemspec.authors = ['Marcello Barnaba', 'Panmind staff']
|
18
|
+
gemspec.email = ['vjt@openssl.it', 'info@panmind.com']
|
19
19
|
gemspec.homepage = 'http://github.com/Panmind/recaptcha'
|
20
20
|
|
21
21
|
gemspec.files = %w( README.md Rakefile rails/init.rb ) + Dir['lib/**/*']
|
@@ -23,11 +23,11 @@ begin
|
|
23
23
|
gemspec.has_rdoc = true
|
24
24
|
|
25
25
|
gemspec.version = Panmind::Recaptcha::Version
|
26
|
-
gemspec.date = '
|
26
|
+
gemspec.date = '2011-09-20'
|
27
27
|
|
28
28
|
gemspec.require_path = 'lib'
|
29
29
|
|
30
|
-
gemspec.add_dependency
|
30
|
+
gemspec.add_dependency 'rails', '~> 3.0'
|
31
31
|
end
|
32
32
|
rescue LoadError
|
33
33
|
puts 'Jeweler not available. Install it with: gem install jeweler'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'panmind/recaptcha'
|
2
|
+
|
3
|
+
module Panmind
|
4
|
+
module Recaptcha
|
5
|
+
|
6
|
+
if defined? Rails::Railtie
|
7
|
+
class Railtie < Rails::Railtie
|
8
|
+
initializer 'panmind.recaptcha.insert_into_action_controller' do
|
9
|
+
ActiveSupport.on_load :action_controller do
|
10
|
+
Panmind::Recaptcha::Railtie.insert
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class Railtie
|
17
|
+
def self.insert
|
18
|
+
ActionView::Base.instance_eval { include Helpers }
|
19
|
+
ActionController::Base.instance_eval { include Controller }
|
20
|
+
ActionController::TestCase.instance_eval { include TestHelpers } if Rails.env.test?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/panmind/recaptcha.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
require 'timeout'
|
2
2
|
|
3
|
-
if defined?(Rails)
|
3
|
+
if defined?(Rails)
|
4
|
+
require 'panmind/recaptcha/railtie'
|
5
|
+
|
4
6
|
begin
|
5
7
|
require 'mocha'
|
6
8
|
rescue LoadError
|
7
9
|
print "\n!!\n!! ReCaptcha: to use the test helpers you should gem install mocha\n!!\n\n"
|
8
|
-
end
|
10
|
+
end if Rails.env.test?
|
9
11
|
end
|
10
12
|
|
11
13
|
module Panmind
|
12
14
|
module Recaptcha
|
13
|
-
Version = 1.0
|
15
|
+
Version = '1.0.1'
|
14
16
|
|
15
17
|
class << self
|
16
18
|
attr_accessor :private_key, :public_key, :request_timeout
|
@@ -25,7 +27,7 @@ module Panmind
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def enabled?
|
28
|
-
Rails.env.production?
|
30
|
+
Rails.env.production? || Rails.env.development?
|
29
31
|
end
|
30
32
|
end # << self
|
31
33
|
|
@@ -81,8 +83,9 @@ module Panmind
|
|
81
83
|
return res.first == 'true'
|
82
84
|
|
83
85
|
rescue Timeout::Error
|
84
|
-
#
|
85
|
-
|
86
|
+
# If ever a timeout error happens during the connection with
|
87
|
+
# the service, then return false. It should happen rarely.
|
88
|
+
false
|
86
89
|
end
|
87
90
|
|
88
91
|
def invalid_captcha
|
data/rails/init.rb
CHANGED
@@ -1,7 +1,2 @@
|
|
1
1
|
require 'panmind/recaptcha'
|
2
|
-
|
3
|
-
module Panmind::Recaptcha
|
4
|
-
ActionView::Base.instance_eval { include Helpers }
|
5
|
-
ActionController::Base.instance_eval { include Controller }
|
6
|
-
ActionController::TestCase.instance_eval { include TestHelpers } if Rails.env.test?
|
7
|
-
end
|
2
|
+
Panmind::Recaptcha::Railtie.insert
|
metadata
CHANGED
@@ -1,84 +1,69 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: panmind-recaptcha
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: "1.0"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Marcello Barnaba
|
9
|
+
- Panmind staff
|
13
10
|
autorequire:
|
14
11
|
bindir: bin
|
15
12
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-11-17 00:00:00 +01:00
|
13
|
+
date: 2011-09-20 00:00:00.000000000 +02:00
|
18
14
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
21
17
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: &2152506860 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
|
-
requirements:
|
20
|
+
requirements:
|
26
21
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 8
|
33
|
-
version: 2.3.8
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '3.0'
|
34
24
|
type: :runtime
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *2152506860
|
27
|
+
description: ReCaptcha implements view helpers to generate ReCaptcha code, with the
|
28
|
+
noscript counterpart, required methods that interface with the HTTP API for captcha
|
29
|
+
verification, a DSL to generate a before_filter and the code to implement AJAX captcha
|
30
|
+
validation.
|
31
|
+
email:
|
32
|
+
- vjt@openssl.it
|
33
|
+
- info@panmind.com
|
38
34
|
executables: []
|
39
|
-
|
40
35
|
extensions: []
|
41
|
-
|
42
|
-
extra_rdoc_files:
|
36
|
+
extra_rdoc_files:
|
43
37
|
- README.md
|
44
|
-
files:
|
38
|
+
files:
|
45
39
|
- README.md
|
46
40
|
- Rakefile
|
47
41
|
- lib/panmind/recaptcha.rb
|
42
|
+
- lib/panmind/recaptcha/railtie.rb
|
48
43
|
- rails/init.rb
|
49
44
|
has_rdoc: true
|
50
45
|
homepage: http://github.com/Panmind/recaptcha
|
51
46
|
licenses: []
|
52
|
-
|
53
47
|
post_install_message:
|
54
|
-
rdoc_options:
|
55
|
-
|
56
|
-
require_paths:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
57
50
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
52
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
- 0
|
66
|
-
version: "0"
|
67
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
58
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
76
63
|
requirements: []
|
77
|
-
|
78
64
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.6.2
|
80
66
|
signing_key:
|
81
67
|
specification_version: 3
|
82
68
|
summary: ReCaptcha for Rails - With AJAX Validation
|
83
69
|
test_files: []
|
84
|
-
|