winton-captcha 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/init.rb +1 -14
- data/lib/captcha.rb +14 -1
- metadata +1 -1
data/init.rb
CHANGED
@@ -1,14 +1 @@
|
|
1
|
-
require 'captcha'
|
2
|
-
|
3
|
-
ActionController::Base.send :include, CaptchaActions
|
4
|
-
|
5
|
-
to = "public/images/captchas"
|
6
|
-
unless File.exists?(to)
|
7
|
-
FileUtils.mkdir_p to
|
8
|
-
(0..99).each do |x|
|
9
|
-
c = Captcha.new(6)
|
10
|
-
File.open("#{to}/#{c.code}.jpg", 'w') do |f|
|
11
|
-
f << c.code_image
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
1
|
+
require 'captcha'
|
data/lib/captcha.rb
CHANGED
@@ -43,4 +43,17 @@ class Captcha
|
|
43
43
|
GC.start
|
44
44
|
end
|
45
45
|
|
46
|
-
end
|
46
|
+
end
|
47
|
+
|
48
|
+
to = "public/images/captchas"
|
49
|
+
unless File.exists?(to)
|
50
|
+
FileUtils.mkdir_p to
|
51
|
+
(0..99).each do |x|
|
52
|
+
c = Captcha.new(6)
|
53
|
+
File.open("#{to}/#{c.code}.jpg", 'w') do |f|
|
54
|
+
f << c.code_image
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
ActionController::Base.send :include, CaptchaActions
|