negative_captcha 0.2.beta2 → 0.2.beta3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,13 @@
|
|
1
1
|
module ActionView
|
2
2
|
module Helpers
|
3
3
|
class FormBuilder
|
4
|
+
def negative_captcha(captcha)
|
5
|
+
[
|
6
|
+
hidden_field_tag('timestamp', captcha.timestamp),
|
7
|
+
hidden_field_tag('spinner', captcha.spinner),
|
8
|
+
].join
|
9
|
+
end
|
10
|
+
|
4
11
|
def negative_text_field(captcha, method, options = {})
|
5
12
|
html = @template.negative_text_field_tag(
|
6
13
|
captcha,
|
@@ -1,64 +1,62 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module FormTagHelpers
|
4
|
+
def negative_captcha(captcha)
|
5
|
+
[
|
6
|
+
hidden_field_tag('timestamp', captcha.timestamp),
|
7
|
+
hidden_field_tag('spinner', captcha.spinner),
|
8
|
+
].join
|
9
|
+
end
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
def negative_text_field_tag(negative_captcha, field, options={})
|
12
|
+
text_field_tag(
|
13
|
+
negative_captcha.fields[field],
|
14
|
+
negative_captcha.values[field],
|
15
|
+
options
|
16
|
+
) +
|
17
|
+
content_tag('div', :style => 'position: absolute; left: -2000px;') do
|
18
|
+
text_field_tag(field, '', :tabindex => '999', :autocomplete => 'off')
|
19
|
+
end
|
20
|
+
end
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
def negative_text_area_tag(negative_captcha, field, options={})
|
23
|
+
text_area_tag(
|
24
|
+
negative_captcha.fields[field],
|
25
|
+
negative_captcha.values[field],
|
26
|
+
options
|
27
|
+
) +
|
28
|
+
content_tag('div', :style => 'position: absolute; left: -2000px;') do
|
29
|
+
text_area_tag(field, '', :tabindex => '999', :autocomplete => 'off')
|
30
|
+
end
|
23
31
|
end
|
24
|
-
end
|
25
32
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
def negative_hidden_field_tag(negative_captcha, field, options={})
|
34
|
+
hidden_field_tag(
|
35
|
+
negative_captcha.fields[field],
|
36
|
+
negative_captcha.values[field],
|
37
|
+
options
|
38
|
+
) +
|
39
|
+
"<div style='position: absolute; left: -2000px;'>" +
|
40
|
+
hidden_field_tag(field, '', :tabindex => '999') +
|
41
|
+
"</div>"
|
34
42
|
end
|
35
|
-
end
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
def negative_password_field_tag(negative_captcha, field, options={})
|
45
|
+
password_field_tag(
|
46
|
+
negative_captcha.fields[field],
|
47
|
+
negative_captcha.values[field],
|
48
|
+
options
|
49
|
+
) +
|
50
|
+
"<div style='position: absolute; left: -2000px;'>" +
|
51
|
+
password_field_tag(field, '', :tabindex => '999') +
|
52
|
+
"</div>"
|
53
|
+
end
|
47
54
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
negative_captcha.values[field],
|
52
|
-
options) +
|
53
|
-
"<div style='position: absolute; left: -2000px;'>" +
|
54
|
-
password_field_tag(field, '', :tabindex => '999') +
|
55
|
-
"</div>"
|
55
|
+
def negative_label_tag(negative_captcha, field, name, options={})
|
56
|
+
label_tag(negative_captcha.fields[field], name, options)
|
57
|
+
end
|
56
58
|
end
|
57
59
|
|
58
|
-
|
59
|
-
label_tag(negative_captcha.fields[field], name, options)
|
60
|
-
end
|
60
|
+
#TODO: Select, check_box, etc
|
61
61
|
end
|
62
|
-
|
63
|
-
#TODO: Select, check_box, etc
|
64
62
|
end
|
data/lib/negative_captcha.rb
CHANGED