glebtv-simple_captcha 0.4.6 → 0.5.1

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: 5a87db77c30204006aa75677d98b5846a2831c18
4
+ data.tar.gz: acddb79ffa2fee1f6ae7830071d0895eae2ce016
5
+ SHA512:
6
+ metadata.gz: 1e738a5d94ffa284ac7d6a275d8ac75376537ee428a7680daf783b8b3f4cd72ca728c20cd317d310bd5555dafa49c4aaf028c0a0bcb947e1436462281eab099c
7
+ data.tar.gz: 36d60c331bb9438611ac27fe068af7dcca0b44bbc28cf14967f0bc19853173f431414ea0e8393eb3c2472f596db1d4391cfe186cf79f593284641df51da531d9
@@ -8,6 +8,30 @@ adding up a single line in views and in controllers/models.
8
8
  SimpleCaptcha is available to be used with Rails 3 or above and also it provides the
9
9
  backward compatibility with previous versions of Rails.
10
10
 
11
+ == Rails 4 and strong parameters
12
+
13
+ Should work like so:
14
+
15
+ class ContactsController < ApplicationController
16
+ def create
17
+ @contact_message = ContactMessage.new(message_params)
18
+
19
+ if @contact_message.save_with_captcha
20
+ redirect_to :contacts_sent
21
+ else
22
+ if @contact_message.errors.any?
23
+ flash.now[:alert] = @contact_message.errors.full_messages.join("\n")
24
+ end
25
+ render action: "new"
26
+ end
27
+ end
28
+
29
+ private
30
+ def message_params
31
+ params.require(:contact_message).permit(:name, :email, :content, :captcha, :captcha_key)
32
+ end
33
+ end
34
+
11
35
  == For mongoid support
12
36
 
13
37
  Just do
@@ -59,7 +59,7 @@ module SimpleCaptcha #:nodoc
59
59
  SimpleCaptcha::Utils::simple_captcha_passed!(captcha_key)
60
60
  return true
61
61
  else
62
- message = simple_captcha_options[:message] || I18n.t(self.class.model_name.downcase, :scope => [:simple_captcha, :message], :default => :default)
62
+ message = simple_captcha_options[:message] || I18n.t(self.class.model_name.to_s.downcase, scope: [:simple_captcha, :message], default: 'Invalid CAPTCHA')
63
63
  simple_captcha_options[:add_to_base] ? errors.add_to_base(message) : errors.add(:captcha, message)
64
64
  return false
65
65
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module SimpleCaptcha
3
- VERSION = "0.4.6".freeze
3
+ VERSION = "0.5.1".freeze
4
4
  end
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glebtv-simple_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
5
- prerelease:
4
+ version: 0.5.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - GlebTv
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-02 00:00:00.000000000 Z
11
+ date: 2013-06-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.2'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.2'
30
27
  description: .
@@ -36,49 +33,48 @@ extra_rdoc_files:
36
33
  files:
37
34
  - lib/simple_captcha.rb
38
35
  - lib/glebtv-simple_captcha.rb
39
- - lib/generators/simple_captcha_generator.rb
40
- - lib/generators/templates/partial.erb
41
- - lib/generators/templates/migration.rb
42
36
  - lib/generators/USAGE
43
- - lib/simple_captcha/model_helpers.rb
44
- - lib/simple_captcha/controller.rb
45
- - lib/simple_captcha/storage/mongoid.rb
37
+ - lib/generators/templates/migration.rb
38
+ - lib/generators/templates/partial.erb
39
+ - lib/generators/simple_captcha_generator.rb
46
40
  - lib/simple_captcha/storage/active_record.rb
41
+ - lib/simple_captcha/storage/mongoid.rb
42
+ - lib/simple_captcha/controller.rb
43
+ - lib/simple_captcha/utils.rb
44
+ - lib/simple_captcha/engine.rb
47
45
  - lib/simple_captcha/view.rb
48
- - lib/simple_captcha/hooks/form_builder.rb
46
+ - lib/simple_captcha/version.rb
47
+ - lib/simple_captcha/model_helpers.rb
48
+ - lib/simple_captcha/image.rb
49
49
  - lib/simple_captcha/hooks/formtastic.rb
50
50
  - lib/simple_captcha/hooks/simple_form.rb
51
+ - lib/simple_captcha/hooks/form_builder.rb
51
52
  - lib/simple_captcha/middleware.rb
52
- - lib/simple_captcha/engine.rb
53
- - lib/simple_captcha/image.rb
54
- - lib/simple_captcha/utils.rb
55
- - lib/simple_captcha/version.rb
56
53
  - Rakefile
57
54
  - README.rdoc
58
55
  - test/simple_captcha_test.rb
59
56
  homepage: http://github.com/glebtv/simple-captcha
60
57
  licenses: []
58
+ metadata: {}
61
59
  post_install_message:
62
60
  rdoc_options: []
63
61
  require_paths:
64
62
  - lib
65
63
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
64
  requirements:
68
- - - ! '>='
65
+ - - '>='
69
66
  - !ruby/object:Gem::Version
70
67
  version: '0'
71
68
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
69
  requirements:
74
- - - ! '>='
70
+ - - '>='
75
71
  - !ruby/object:Gem::Version
76
72
  version: '0'
77
73
  requirements: []
78
74
  rubyforge_project:
79
- rubygems_version: 1.8.25
75
+ rubygems_version: 2.0.3
80
76
  signing_key:
81
- specification_version: 3
77
+ specification_version: 4
82
78
  summary: A fork of a fork of a fork of simple_captcha.
83
79
  test_files:
84
80
  - test/simple_captcha_test.rb