spamtrap 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spamtrap/controller.rb +25 -0
- data/lib/spamtrap/helper.rb +10 -0
- data/lib/spamtrap/version.rb +5 -0
- data/lib/spamtrap.rb +4 -0
- metadata +70 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
module Spamtrap
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ActsAsMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ActsAsMethods
|
8
|
+
def spamtrap(actions, parameter='spamtrap')
|
9
|
+
raise 'Spamtrap must have actions defined.' if actions.empty?
|
10
|
+
# helper_attr :spamtrap_parameter
|
11
|
+
# attr_accessor :spamtrap_parameter
|
12
|
+
# self.spamtrap_parameter = parameter
|
13
|
+
before_filter(:only => actions.is_a?(Array) ? actions : [actions]) do |controller|
|
14
|
+
controller.instance_eval do
|
15
|
+
if params[parameter.to_s].present?
|
16
|
+
render :nothing => true, :status => 200
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
ActionController::Base.send :include, Spamtrap
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class ActionView::Helpers::FormBuilder
|
2
|
+
def spamtrap(parameter='spamtrap', options={})
|
3
|
+
# parameter ||= @template.controller.spamtrap_parameter || 'spamtrap'
|
4
|
+
options.reverse_merge({:class => 'spamtrap'})
|
5
|
+
@template.content_tag(:div, options) do
|
6
|
+
@template.label_tag(parameter) +
|
7
|
+
@template.text_field_tag(parameter)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/spamtrap.rb
ADDED
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spamtrap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Cedric Howe
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-20 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Create bogus form fields (honeypots) that will be filled-in by spambots. When submitted, the form data will be discarded while still returning a 200 response.
|
23
|
+
email: cedric@freezerbox.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- lib/spamtrap/controller.rb
|
32
|
+
- lib/spamtrap/helper.rb
|
33
|
+
- lib/spamtrap/version.rb
|
34
|
+
- lib/spamtrap.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/cedric/spamtrap/
|
37
|
+
licenses: []
|
38
|
+
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project: spamtrap
|
65
|
+
rubygems_version: 1.3.7
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Simple spamtrap for spambots.
|
69
|
+
test_files: []
|
70
|
+
|