simple_captcha_audio 0.0.1.rc2 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_captcha_audio/middleware.rb +0 -29
- data/lib/simple_captcha_audio/version.rb +1 -1
- data/lib/simple_captcha_audio/view.rb +4 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 453083aa1e1b3649b9e8fa96c00bb20a876c2045
|
4
|
+
data.tar.gz: 9c458b9c3ede79ec478d4035ca726706c36c0c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac2b760e398554eed39ef566ed97491270a185aecc21a9cab31508428beae811eee456557da57c46756fcaa997a42b74816185032cd02d9ea21ca49242e2db15
|
7
|
+
data.tar.gz: 0639c3349e0c62cfb142f3a45afd80971d6fc722f035e5597333bef162a404bdf4eb4b9a3ae9e7f91e2731ae124e3b2fe4c07a6be77ac30bf72b704b81db2541
|
@@ -35,34 +35,5 @@ module SimpleCaptcha
|
|
35
35
|
[status, headers, body]
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
39
|
-
def refresh_code(env)
|
40
|
-
request = Rack::Request.new(env)
|
41
|
-
|
42
|
-
request.session.delete :captcha
|
43
|
-
key = simple_captcha_key(nil, request)
|
44
|
-
options = {}
|
45
|
-
options[:field_value] = set_simple_captcha_data(key, options)
|
46
|
-
url = simple_captcha_image_url(key, options)
|
47
|
-
|
48
|
-
status = 200
|
49
|
-
id = request.params['id']
|
50
|
-
captcha_hidden_field_id = simple_captch_hidden_field_id(id)
|
51
|
-
|
52
|
-
audio_id = generate_audio_id(id)
|
53
|
-
audio_url = simple_captcha_audio_url(key, options)
|
54
|
-
|
55
|
-
body = %Q{
|
56
|
-
$("##{id}").attr('src', '#{url}');
|
57
|
-
$("##{audio_id}").attr('src', '#{audio_url}')
|
58
|
-
$("##{ captcha_hidden_field_id }").attr('value', '#{key}');
|
59
|
-
}
|
60
|
-
headers = {'Content-Type' => 'text/javascript; charset=utf-8', "Content-Disposition" => "inline; filename='captcha.js'", "Content-Length" => body.length.to_s}.merge(SimpleCaptcha.extra_response_headers)
|
61
|
-
[status, headers, [body]]
|
62
|
-
end
|
63
|
-
|
64
|
-
def generate_audio_id(id)
|
65
|
-
id.gsub('simple_captcha', simple_captcha_id_prefix)
|
66
|
-
end
|
67
38
|
end
|
68
39
|
end
|
@@ -4,11 +4,9 @@ module SimpleCaptcha
|
|
4
4
|
alias_method :__simple_captcha_options__, :simple_captcha_options
|
5
5
|
|
6
6
|
def simple_captcha_options(options = {})
|
7
|
-
|
7
|
+
key = simple_captcha_key(options[:object])
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
super_options.merge({
|
9
|
+
__simple_captcha_options__(options).merge({
|
12
10
|
audio: simple_captcha_audio(key, options)
|
13
11
|
})
|
14
12
|
end
|
@@ -17,7 +15,7 @@ module SimpleCaptcha
|
|
17
15
|
def simple_captcha_audio(simple_captcha_key, options = {})
|
18
16
|
url = simple_captcha_audio_url simple_captcha_key, options: options
|
19
17
|
id = simple_captcha_audio_id(options)
|
20
|
-
tag('audio', :src => url, :id => id
|
18
|
+
tag('audio', :src => url, :id => id)
|
21
19
|
end
|
22
20
|
|
23
21
|
def simple_captcha_audio_url(simple_captcha_key, options = {})
|
@@ -30,11 +28,7 @@ module SimpleCaptcha
|
|
30
28
|
end
|
31
29
|
|
32
30
|
def simple_captcha_audio_id(options={})
|
33
|
-
"
|
34
|
-
end
|
35
|
-
|
36
|
-
def simple_captcha_id_prefix
|
37
|
-
"simple_captcha-audio"
|
31
|
+
"simple_captcha-audio-#{options[:field_value][0..10]}"
|
38
32
|
end
|
39
33
|
end
|
40
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_captcha_audio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aditya Kapoor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,9 +114,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
119
|
+
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
122
|
rubygems_version: 2.2.2
|