recaptcha_check 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recaptcha_check.rb +7 -7
- 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: 5464736b10d278eca81f52020cea05c716fa74dc4da300bf911042eae92ff640
|
4
|
+
data.tar.gz: f98a3f7e233735ca8e4dbc21134c4ea49408465fab0f65369228167661389090
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff582f31ff5a06c1c3661b1cba6ed3650d1cf0e063350401ffa7ada5dcceba6ddf38a5733d873210074f8a224a8cab2dfc77a4a8b36d0bf6f13bbea75f934463
|
7
|
+
data.tar.gz: c1e1e0c9d2997fb738c620b421e9cba2ee4cdf88dcb1fd3e24c331265a77f4f171a710bcb9b0a77f2a473b2bc972fbcfc49c3eaef68ccc83795dd8df91b648e1
|
data/lib/recaptcha_check.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
class RecaptchaCheck
|
2
2
|
def self.verify(params, ip = nil)
|
3
|
-
new(params['g-recaptcha-response'], ip).
|
3
|
+
new(params['g-recaptcha-response'], ip).verify_recaptcha
|
4
4
|
end
|
5
5
|
|
6
6
|
def self.register(recaptcha_secret_key)
|
7
7
|
ENV[RECAPTCHACHECK_SECRET_KEY] = recaptcha_secret_key
|
8
8
|
end
|
9
|
+
|
10
|
+
def verify_recaptcha
|
11
|
+
require 'httparty'
|
12
|
+
recaptcha_response = HTTParty.get(recaptcha_url(@response, self.secret, @ip))
|
13
|
+
self.response_success?(recaptcha_response)
|
14
|
+
end
|
9
15
|
|
10
16
|
private
|
11
17
|
|
@@ -16,12 +22,6 @@ class RecaptchaCheck
|
|
16
22
|
@ip = ip
|
17
23
|
end
|
18
24
|
|
19
|
-
def verify
|
20
|
-
require 'httparty'
|
21
|
-
recaptcha_response = HTTParty.get(recaptcha_url(@response, self.secret, @ip))
|
22
|
-
self.response_success?(recaptcha_response)
|
23
|
-
end
|
24
|
-
|
25
25
|
def recaptcha_url(response, secret, ip)
|
26
26
|
"https://www.google.com/recaptcha/api/siteverify?secret=#{secret}&response=#{response}&remoteip=#{ip}"
|
27
27
|
end
|