rucaptcha 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/rucaptcha/controller_helpers.rb +9 -1
- data/lib/rucaptcha/version.rb +1 -1
- data/lib/rucaptcha/view_helpers.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83dddcf03d3e8acd1121b05f1336d520dc5af592
|
4
|
+
data.tar.gz: 68308146916e90db9ff32b4f02906988528812b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b79383bab6530fb996518f8faa08e67fae2bb8c43de138a5e874ebe4866a5df7e901ea7a5e4475eb50b6d060d2e61470b18d3add84fbe336f0e9184762a1b2dc
|
7
|
+
data.tar.gz: 7d43f1c0416454ebbc8bc19c012e90712d41acae249a77c59eaec6be1a02a4eff4c45e3f2940e22c035d8d5193351c7a11b18d2331c0b52bbc3ed87eb175a49f
|
data/CHANGELOG.md
CHANGED
@@ -7,11 +7,19 @@ module RuCaptcha
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def generate_rucaptcha
|
10
|
-
session[:_rucaptcha]
|
10
|
+
session[:_rucaptcha] = RuCaptcha::Captcha.random_chars
|
11
|
+
session[:_rucaptcha_at] = Time.now.to_i
|
12
|
+
|
11
13
|
RuCaptcha::Captcha.create(session[:_rucaptcha])
|
12
14
|
end
|
13
15
|
|
14
16
|
def verify_rucaptcha?(resource = nil)
|
17
|
+
rucaptcha_at = session[:_rucaptcha_at].to_i
|
18
|
+
# Captcha chars in Session expire in 2 minutes
|
19
|
+
if rucaptcha_at.blank? || (Time.now.to_i - rucaptcha_at) > 120
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
|
15
23
|
right = params[:_rucaptcha].present? && session[:_rucaptcha].present? &&
|
16
24
|
params[:_rucaptcha].downcase.strip == session[:_rucaptcha]
|
17
25
|
if resource && resource.respond_to?(:errors)
|
data/lib/rucaptcha/version.rb
CHANGED