easy_captcha-ftbpro 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bdc64529e568fbe284c98ee2813cbd0faf7adfae
4
+ data.tar.gz: f268d34bad1e5ead506b84cc3af3f6a6bd1fc0fb
5
+ SHA512:
6
+ metadata.gz: b08870c761acaa751d1971eae6b4773ef6c304f848cfdf58420348e26926da4c5decad8efa3b57809364602396c2fab2003bf0489f7529bf8279bff8f654b87c
7
+ data.tar.gz: bc6311782b8aacbe94cf31a95634b87f5ae700e8349ae551360de03daeeea3afc691dca8152372516b19a6423b31ca24887755f93ad8340af1b06cd9f08de97f
@@ -0,0 +1,14 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # jeweler generated
12
+ pkg
13
+
14
+ .DS_Store
@@ -0,0 +1,10 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ - jruby
5
+ notifications:
6
+ recipients:
7
+ - develop@marco-scholl.de
8
+ branches:
9
+ only:
10
+ - master
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,109 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ easy_captcha (0.6.4)
5
+ bundler (>= 1.1.0)
6
+ rails (>= 3.0.0)
7
+ rmagick (>= 2.13.1)
8
+ rspec-rails (>= 2.8.1)
9
+ simplecov (>= 0.3.8)
10
+ yard (>= 0.7.0)
11
+
12
+ GEM
13
+ remote: http://rubygems.org/
14
+ specs:
15
+ actionmailer (4.0.0)
16
+ actionpack (= 4.0.0)
17
+ mail (~> 2.5.3)
18
+ actionpack (4.0.0)
19
+ activesupport (= 4.0.0)
20
+ builder (~> 3.1.0)
21
+ erubis (~> 2.7.0)
22
+ rack (~> 1.5.2)
23
+ rack-test (~> 0.6.2)
24
+ activemodel (4.0.0)
25
+ activesupport (= 4.0.0)
26
+ builder (~> 3.1.0)
27
+ activerecord (4.0.0)
28
+ activemodel (= 4.0.0)
29
+ activerecord-deprecated_finders (~> 1.0.2)
30
+ activesupport (= 4.0.0)
31
+ arel (~> 4.0.0)
32
+ activerecord-deprecated_finders (1.0.3)
33
+ activesupport (4.0.0)
34
+ i18n (~> 0.6, >= 0.6.4)
35
+ minitest (~> 4.2)
36
+ multi_json (~> 1.3)
37
+ thread_safe (~> 0.1)
38
+ tzinfo (~> 0.3.37)
39
+ arel (4.0.0)
40
+ atomic (1.1.10)
41
+ builder (3.1.4)
42
+ diff-lcs (1.2.4)
43
+ erubis (2.7.0)
44
+ hike (1.2.3)
45
+ i18n (0.6.4)
46
+ mail (2.5.4)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.23)
50
+ minitest (4.7.5)
51
+ multi_json (1.7.7)
52
+ polyglot (0.3.3)
53
+ rack (1.5.2)
54
+ rack-test (0.6.2)
55
+ rack (>= 1.0)
56
+ rails (4.0.0)
57
+ actionmailer (= 4.0.0)
58
+ actionpack (= 4.0.0)
59
+ activerecord (= 4.0.0)
60
+ activesupport (= 4.0.0)
61
+ bundler (>= 1.3.0, < 2.0)
62
+ railties (= 4.0.0)
63
+ sprockets-rails (~> 2.0.0)
64
+ railties (4.0.0)
65
+ actionpack (= 4.0.0)
66
+ activesupport (= 4.0.0)
67
+ rake (>= 0.8.7)
68
+ thor (>= 0.18.1, < 2.0)
69
+ rake (10.1.0)
70
+ rmagick (2.13.2)
71
+ rspec-core (2.14.4)
72
+ rspec-expectations (2.14.0)
73
+ diff-lcs (>= 1.1.3, < 2.0)
74
+ rspec-mocks (2.14.1)
75
+ rspec-rails (2.14.0)
76
+ actionpack (>= 3.0)
77
+ activesupport (>= 3.0)
78
+ railties (>= 3.0)
79
+ rspec-core (~> 2.14.0)
80
+ rspec-expectations (~> 2.14.0)
81
+ rspec-mocks (~> 2.14.0)
82
+ simplecov (0.7.1)
83
+ multi_json (~> 1.0)
84
+ simplecov-html (~> 0.7.1)
85
+ simplecov-html (0.7.1)
86
+ sprockets (2.10.0)
87
+ hike (~> 1.2)
88
+ multi_json (~> 1.0)
89
+ rack (~> 1.0)
90
+ tilt (~> 1.1, != 1.3.0)
91
+ sprockets-rails (2.0.0)
92
+ actionpack (>= 3.0)
93
+ activesupport (>= 3.0)
94
+ sprockets (~> 2.8)
95
+ thor (0.18.1)
96
+ thread_safe (0.1.0)
97
+ atomic
98
+ tilt (1.4.1)
99
+ treetop (1.4.14)
100
+ polyglot
101
+ polyglot (>= 0.3.1)
102
+ tzinfo (0.3.37)
103
+ yard (0.8.6.2)
104
+
105
+ PLATFORMS
106
+ ruby
107
+
108
+ DEPENDENCIES
109
+ easy_captcha!
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Marco Scholl
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,154 @@
1
+ = EasyCaptcha
2
+ A simple captcha implementation for rails 3 based on rmagick
3
+
4
+ Tested with Rails 3.2.8
5
+
6
+ https://travis-ci.org/phatworx/easy_captcha.png
7
+
8
+ == Installation
9
+ add to Gemfile
10
+ gem 'easy_captcha'
11
+ gem 'rmagick'
12
+
13
+ for java you can use
14
+
15
+ gem 'rmagick4j'
16
+
17
+ after bundle execute
18
+ rails g easy_captcha:install
19
+
20
+ == Configuration
21
+ You can configure easy_captcha in "config/initializers/easy_captcha.rb", if you want to customize the default configuration
22
+
23
+ EasyCaptcha.setup do |config|
24
+ # Cache
25
+ # config.cache = true
26
+ # Cache temp dir from Rails.root
27
+ # config.cache_temp_dir = Rails.root.join('tmp', 'captchas')
28
+ # Cache size
29
+ # config.cache_size = 500
30
+ # Cache expire
31
+ # config.cache_expire = 1.day
32
+
33
+ # Chars
34
+ # config.chars = %w(2 3 4 5 6 7 9 A C D E F G H J K L M N P Q R S T U X Y Z)
35
+
36
+ # Length
37
+ # config.length = 6
38
+
39
+ # Image
40
+ # config.image_height = 40
41
+ # config.image_width = 140
42
+
43
+ # eSpeak (default disabled)
44
+ # config.espeak do |espeak|
45
+ # Amplitude, 0 to 200
46
+ # espeak.amplitude = 80..120
47
+
48
+ # Word gap. Pause between words
49
+ # espeak.gap = 80
50
+
51
+ # Pitch adjustment, 0 to 99
52
+ # espeak.pitch = 30..70
53
+
54
+ # Use voice file of this name from espeak-data/voices
55
+ # espeak.voice = nil
56
+ # end
57
+
58
+ # configure generator
59
+ # config.generator :default do |generator|
60
+
61
+ # Font
62
+ # generator.font_size = 24
63
+ # generator.font_fill_color = '#333333'
64
+ # generator.font_stroke_color = '#000000'
65
+ # generator.font_stroke = 0
66
+ # generator.font = File.expand_path('../../resources/afont.ttf', __FILE__)
67
+
68
+
69
+ # Background color
70
+ # generator.image_background_color = "#FFFFFF"
71
+ # Or background image (e.g. transparent png)
72
+ # generator.background_image = File.expand_path('../../resources/captcha_bg.png', __FILE__)
73
+
74
+ # Wave
75
+ # generator.wave = true
76
+ # generator.wave_length = (60..100)
77
+ # generator.wave_amplitude = (3..5)
78
+
79
+ # Sketch
80
+ # generator.sketch = true
81
+ # generator.sketch_radius = 3
82
+ # generator.sketch_sigma = 1
83
+
84
+ # Implode
85
+ # generator.implode = 0.1
86
+
87
+ # Blur
88
+ # generator.blur = true
89
+ # generator.blur_radius = 1
90
+ # generator.blur_sigma = 2
91
+ # end
92
+ end
93
+
94
+ == Caching
95
+ It is strongly recommended to enable caching. You can see the three paramters which you have to fill in your config file below.
96
+
97
+ EasyCaptcha.setup do |config|
98
+ # Cache
99
+ config.cache = true
100
+ # Cache temp dir from Rails.root
101
+ config.cache_temp_dir = Rails.root.join('tmp', 'captchas')
102
+ # Cache expire
103
+ config.cache_expire = 1.day
104
+ # Cache size
105
+ # config.cache_size = 500
106
+ end
107
+
108
+ == Requirements
109
+
110
+ * RMagick
111
+ * Rails 3 (http://github.com/rails/rails)
112
+
113
+ == Example
114
+
115
+ <% form_tag '/' do %>
116
+ <% if request.post? %>
117
+ <p><%= valid_captcha?(params[:captcha]) ? 'valid' : 'invalid' %> captcha</p>
118
+ <% end %>
119
+ <p><%= captcha_tag %></p>
120
+ <p><%= text_field_tag :captcha %></p>
121
+ <p><%= submit_tag 'Validate' %></p>
122
+ <% end %>
123
+
124
+ == Example app
125
+ You find an example app under: http://github.com/phatworx/easy_captcha_example
126
+
127
+ == History
128
+ * 0.1 init
129
+ * 0.2 cache support for high frequented sites
130
+ * 0.3 use generators, optimizations, update licence to same of all my plugins
131
+ * 0.4 generator support
132
+ * 0.5 (transparent) background support
133
+ * 0.6 espeak support for barrier-free support
134
+
135
+ == Maintainers
136
+
137
+ * Team Phatworx (http://github.com/phatworx)
138
+ * Marco Scholl (http://github.com/traxanos)
139
+ * Alexander Dreher (http://github.com/alexdreher)
140
+ * Christoph Chilian (http://github.com/cc-web)
141
+
142
+ == Contributing to EasyCaptcha
143
+
144
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
145
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
146
+ * Fork the project
147
+ * Start a feature/bugfix branch
148
+ * Commit and push until you are happy with your contribution
149
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
150
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
151
+
152
+ == Copyright
153
+
154
+ Copyright (c) 2010 Marco Scholl. See LICENSE.txt for further details.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+
5
+ require 'yard'
6
+ YARD::Rake::YardocTask.new
@@ -0,0 +1,41 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "easy_captcha/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{easy_captcha-ftbpro}
7
+ s.version = EasyCaptcha::VERSION
8
+
9
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.authors = [%q{Marco Scholl}, %q{Alexander Dreher}]
11
+ s.date = %q{2011-09-15}
12
+ s.description = %q{Captcha-Plugin for Rails}
13
+ s.email = %q{team@phatworx.de}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE.txt",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = `git ls-files`.split("\n")
19
+
20
+ s.homepage = %q{http://github.com/phatworx/easy_captcha}
21
+ s.licenses = [%q{MIT}]
22
+ s.rubygems_version = %q{1.8.15}
23
+ s.summary = %q{Captcha-Plugin for Rails}
24
+
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
27
+ s.require_paths = ["lib"]
28
+
29
+ s.add_dependency('rails', [">= 3.0.0"])
30
+ s.add_dependency('bundler', [">= 1.1.0"])
31
+ s.add_dependency('simplecov', [">= 0.3.8"])
32
+ s.add_dependency('rspec-rails', [">= 2.8.1"])
33
+ s.add_dependency('yard', [">= 0.7.0"])
34
+
35
+ if defined?(PLATFORM) && PLATFORM == 'java'
36
+ s.add_runtime_dependency('rmagick4j','>= 0.3.7')
37
+ else
38
+ s.add_runtime_dependency('rmagick','>= 2.13.1')
39
+ end
40
+ end
41
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'easy_captcha'
@@ -0,0 +1,132 @@
1
+ require 'RMagick' unless defined?(Magick)
2
+ require 'rails'
3
+ require 'action_controller'
4
+ require 'active_record'
5
+ require 'active_support'
6
+
7
+ # Captcha-Plugin for Rails
8
+ module EasyCaptcha
9
+ autoload :Espeak, 'easy_captcha/espeak'
10
+ autoload :Captcha, 'easy_captcha/captcha'
11
+ autoload :Controller, 'easy_captcha/controller'
12
+ autoload :ModelHelpers, 'easy_captcha/model_helpers'
13
+ autoload :ViewHelpers, 'easy_captcha/view_helpers'
14
+ autoload :ControllerHelpers, 'easy_captcha/controller_helpers'
15
+ autoload :Generator, 'easy_captcha/generator'
16
+
17
+ # Cache
18
+ mattr_accessor :cache
19
+ @@cache = false
20
+
21
+ # Cache temp
22
+ mattr_accessor :cache_temp_dir
23
+ @@cache_temp_dir = nil
24
+
25
+ # Cache size
26
+ mattr_accessor :cache_size
27
+ @@cache_size = 500
28
+
29
+ # Cache expire
30
+ mattr_accessor :cache_expire
31
+ @@cache_expire = nil
32
+
33
+ # Chars
34
+ mattr_accessor :chars
35
+ @@chars = %w(2 3 4 5 6 7 9 A C D E F G H J K L M N P Q R S T U X Y Z)
36
+
37
+ # Length
38
+ mattr_accessor :length
39
+ @@length = 6
40
+
41
+ # Length
42
+ mattr_accessor :image_width, :image_height
43
+ @@image_width = 140
44
+ @@image_height = 40
45
+
46
+ class << self
47
+ # to configure easy_captcha
48
+ # for a sample look the readme.rdoc file
49
+ def setup
50
+ yield self
51
+ end
52
+
53
+ def cache? #:nodoc:
54
+ cache
55
+ end
56
+
57
+ # select generator and configure this
58
+ def generator(generator = nil, &block)
59
+ if generator.nil?
60
+ @generator
61
+ else
62
+ generator = generator.to_s if generator.is_a? Symbol
63
+
64
+ if generator.is_a? String
65
+ generator.gsub!(/^[a-z]|\s+[a-z]/) { |a| a.upcase }
66
+ generator = "EasyCaptcha::Generator::#{generator}".constantize
67
+ end
68
+
69
+ @generator = generator.new &block
70
+ end
71
+ end
72
+
73
+ def espeak=(state)
74
+ if state === true
75
+ @espeak = Espeak.new
76
+ else
77
+ @espeak = false
78
+ end
79
+ end
80
+
81
+ def espeak(&block)
82
+ if block_given?
83
+ @espeak = Espeak.new &block
84
+ else
85
+ @espeak ||= false
86
+ end
87
+ end
88
+
89
+ def espeak?
90
+ not espeak === false
91
+ end
92
+
93
+ # depracated
94
+ def method_missing name, *args
95
+ name = name.to_s # fix for jruby
96
+ depracations = [
97
+ :font_size, :font_fill_color, :font_family, :font_stroke, :font_stroke_color,
98
+ :image_background_color, :sketch, :sketch_radius, :sketch_sigma, :wave,
99
+ :wave_length, :wave_amplitude, :implode, :blur, :blur_radius, :blur_sigma
100
+ ]
101
+
102
+ if depracations.include? name[0..-2].to_sym or depracations.include? name.to_sym
103
+ ActiveSupport::Deprecation.warn "EasyCaptcha.#{name} is deprecated."
104
+ if name[-1,1] == '='
105
+ self.generator.send(name, args.first)
106
+ else
107
+ self.generator.send(name)
108
+ end
109
+ else
110
+ super
111
+ end
112
+ end
113
+
114
+
115
+ # called by rails after initialize
116
+ def init
117
+ require 'easy_captcha/routes'
118
+ ActiveRecord::Base.send :include, ModelHelpers
119
+ ActionController::Base.send :include, ControllerHelpers
120
+ ActionView::Base.send :include, ViewHelpers
121
+
122
+ # set default generator
123
+ generator :default
124
+
125
+ end
126
+ end
127
+ end
128
+
129
+ EasyCaptcha.init
130
+
131
+
132
+