easy_captcha 0.1.8 → 0.1.9

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.
data/README.rdoc CHANGED
@@ -6,7 +6,12 @@ To install easy_captcha
6
6
  gem install easy_captcha
7
7
 
8
8
  Add following line to routes.rb
9
- match "captcha" => EasyCaptcha::Controller
9
+ get :captcha => EasyCaptcha::Controller
10
+
11
+ Add following line to application_controller.rb
12
+ after_filter lambda { session.delete(:captcha) }
13
+
14
+ The last line is very important for security!!!
10
15
 
11
16
  == Configuration
12
17
  You can write this in "config/initializers/easy_captcha.rb", if you want to customize the default configuration
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.8
1
+ 0.1.9
data/easy_captcha.gemspec CHANGED
@@ -1,47 +1,45 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{easy_captcha}
8
- s.version = "0.1.8"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marco Scholl"]
12
- s.date = %q{2010-10-15}
12
+ s.date = %q{2010-12-01}
13
13
  s.description = %q{Captcha-Plugin for Rails}
14
14
  s.email = %q{develop@marco-scholl.de}
15
15
  s.extra_rdoc_files = [
16
16
  "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
- ".gitignore",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "easy_captcha.gemspec",
25
- "init.rb",
26
- "lib/easy_captcha.rb",
27
- "lib/easy_captcha/captcha.rb",
28
- "lib/easy_captcha/controller.rb",
29
- "lib/easy_captcha/controller_helpers.rb",
30
- "lib/easy_captcha/model_helpers.rb",
31
- "lib/easy_captcha/view_helpers.rb",
32
- "resources/captcha.ttf",
33
- "spec/easy_captcha_spec.rb",
34
- "spec/spec.opts",
35
- "spec/spec_helper.rb"
19
+ "MIT-LICENSE",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "easy_captcha.gemspec",
24
+ "init.rb",
25
+ "lib/easy_captcha.rb",
26
+ "lib/easy_captcha/captcha.rb",
27
+ "lib/easy_captcha/controller.rb",
28
+ "lib/easy_captcha/controller_helpers.rb",
29
+ "lib/easy_captcha/model_helpers.rb",
30
+ "lib/easy_captcha/view_helpers.rb",
31
+ "resources/captcha.ttf",
32
+ "spec/easy_captcha_spec.rb",
33
+ "spec/spec.opts",
34
+ "spec/spec_helper.rb"
36
35
  ]
37
36
  s.homepage = %q{http://github.com/traxanos/easy_captcha}
38
- s.rdoc_options = ["--charset=UTF-8"]
39
37
  s.require_paths = ["lib"]
40
38
  s.rubygems_version = %q{1.3.7}
41
39
  s.summary = %q{Captcha-Plugin for Rails}
42
40
  s.test_files = [
43
- "spec/spec_helper.rb",
44
- "spec/easy_captcha_spec.rb"
41
+ "spec/easy_captcha_spec.rb",
42
+ "spec/spec_helper.rb"
45
43
  ]
46
44
 
47
45
  if s.respond_to? :specification_version then
@@ -1,10 +1,10 @@
1
1
  module EasyCaptcha
2
2
  # captcha controller
3
- # match "captcha" => EasyCaptcha::Controller
3
+ # get :captcha => EasyCaptcha::Controller
4
4
  class Controller < ActionController::Base
5
5
  # captcha action send the generated image to browser
6
6
  def captcha
7
7
  send_data generate_captcha, :disposition => 'inline', :type => 'image/png'
8
8
  end
9
9
  end
10
- end
10
+ end
@@ -18,10 +18,11 @@ module EasyCaptcha
18
18
  session[:captcha] = EasyCaptcha.length.times.collect { EasyCaptcha.chars[rand(EasyCaptcha.chars.size)] }.join
19
19
  end
20
20
 
21
- # validate given captcha code
21
+ # validate given captcha code and re
22
22
  def valid_captcha?(code)
23
+ return false if session[:captcha].blank? or code.blank?
23
24
  session[:captcha].to_s.upcase == code.to_s.upcase
24
25
  end
25
26
 
26
27
  end
27
- end
28
+ end
@@ -19,8 +19,8 @@ module EasyCaptcha
19
19
  end
20
20
 
21
21
  def valid_captcha?
22
- errors.add(:captcha, :invalid) unless @captcha.to_s.upcase == @captcha_verification.to_s.upcase
22
+ errors.add(:captcha, :invalid) if @captcha.blank? or @captcha_verification.blank? or @captcha.to_s.upcase != @captcha_verification.to_s.upcase
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 8
9
- version: 0.1.8
8
+ - 9
9
+ version: 0.1.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marco Scholl
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-15 00:00:00 +02:00
17
+ date: 2010-12-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -69,7 +69,6 @@ extensions: []
69
69
  extra_rdoc_files:
70
70
  - README.rdoc
71
71
  files:
72
- - .gitignore
73
72
  - MIT-LICENSE
74
73
  - README.rdoc
75
74
  - Rakefile
@@ -91,8 +90,8 @@ homepage: http://github.com/traxanos/easy_captcha
91
90
  licenses: []
92
91
 
93
92
  post_install_message:
94
- rdoc_options:
95
- - --charset=UTF-8
93
+ rdoc_options: []
94
+
96
95
  require_paths:
97
96
  - lib
98
97
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -119,5 +118,5 @@ signing_key:
119
118
  specification_version: 3
120
119
  summary: Captcha-Plugin for Rails
121
120
  test_files:
122
- - spec/spec_helper.rb
123
121
  - spec/easy_captcha_spec.rb
122
+ - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,14 +0,0 @@
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