rails-captchme 1.0.6 → 1.0.7
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/lib/captchme.rb +31 -0
- data/lib/captchme/version.rb +3 -0
- data/rails-captchme.gemspec +2 -2
- metadata +3 -3
- data/lib/rails/captchme.rb +0 -33
- data/lib/rails/captchme/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4239951900a5c4ba222e4b2e9e056060788425a
|
4
|
+
data.tar.gz: 320e4b8dc3d21d2b6ca2c447f2de789e2cf4ec7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2364320cb9ec155c3ef88b6682c0bf9cb8d273a56aa79a7379767dee5d090b9bd8cf339403e2513b38d5aa9ac11ee6483fc77cab9a27d668727a8ee5857e99e
|
7
|
+
data.tar.gz: d8c16aa9e70f673e082710eac65e209a3cfd49fbc08d9b36e7e0db327d85559e437b9e29485eaf85724fdfc83eac22b20fe730fe0b10bca3fb8379c98f1a5432
|
data/lib/captchme.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require "captchme/version"
|
2
|
+
|
3
|
+
module CAPTCHME
|
4
|
+
require 'net/http'
|
5
|
+
require "uri"
|
6
|
+
|
7
|
+
class Captchme
|
8
|
+
def initialize(private_key, params, ip_client)
|
9
|
+
@private_key = private_key
|
10
|
+
@data = "private_key=" + @private_key + "&challenge_key="+
|
11
|
+
params["captchme_challenge_field"] + "&response=" +
|
12
|
+
params["captchme_response_field"] + "&user_ip=" + ip_client;
|
13
|
+
@headers = {
|
14
|
+
"Content-Type" => "application/x-www-form-urlencoded",
|
15
|
+
"Content-length" => @data.length.to_s,
|
16
|
+
"Connection" => "close"
|
17
|
+
}
|
18
|
+
@uri = URI("http://api.captchme.net/api/verify")
|
19
|
+
@http = Net::HTTP.new(@uri.host, @uri.port)
|
20
|
+
end
|
21
|
+
|
22
|
+
def request
|
23
|
+
@response = @http.post(@uri.path, @data, @headers).body.split
|
24
|
+
end
|
25
|
+
|
26
|
+
def is_valid?
|
27
|
+
@response[0] == 'true'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/rails-captchme.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'captchme/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "rails-captchme"
|
8
|
-
spec.version =
|
8
|
+
spec.version = CAPTCHME::VERSION
|
9
9
|
spec.authors = ["Martin Debrunne"]
|
10
10
|
spec.email = ["martin.debrunne@gmail.com"]
|
11
11
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-captchme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Debrunne
|
@@ -55,8 +55,8 @@ files:
|
|
55
55
|
- Rakefile
|
56
56
|
- bin/console
|
57
57
|
- bin/setup
|
58
|
-
- lib/
|
59
|
-
- lib/
|
58
|
+
- lib/captchme.rb
|
59
|
+
- lib/captchme/version.rb
|
60
60
|
- rails-captchme-1.0.0.gem
|
61
61
|
- rails-captchme-1.0.1.gem
|
62
62
|
- rails-captchme.gemspec
|
data/lib/rails/captchme.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require "rails/captchme/version"
|
2
|
-
|
3
|
-
module Rails
|
4
|
-
module CAPTCHME
|
5
|
-
require 'net/http'
|
6
|
-
require "uri"
|
7
|
-
|
8
|
-
class Captchme
|
9
|
-
def initialize(private_key, params, ip_client)
|
10
|
-
@private_key = private_key
|
11
|
-
@data = "private_key=" + @private_key + "&challenge_key="+
|
12
|
-
params["captchme_challenge_field"] + "&response=" +
|
13
|
-
params["captchme_response_field"] + "&user_ip=" + ip_client;
|
14
|
-
@headers = {
|
15
|
-
"Content-Type" => "application/x-www-form-urlencoded",
|
16
|
-
"Content-length" => @data.length.to_s,
|
17
|
-
"Connection" => "close"
|
18
|
-
}
|
19
|
-
@uri = URI("http://api.captchme.net/api/verify")
|
20
|
-
@http = Net::HTTP.new(@uri.host, @uri.port)
|
21
|
-
end
|
22
|
-
|
23
|
-
def request
|
24
|
-
@response = @http.post(@uri.path, @data, @headers).body.split
|
25
|
-
end
|
26
|
-
|
27
|
-
def is_valid?
|
28
|
-
@response[0] == 'true'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|