rucaptcha_number 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93292a4eac153a644e6791c826ffa83e43abb14cbe20e43398c47376ac879f7a
4
- data.tar.gz: 307db233b9be982d4e8e299ef3fc4e5a974fe811efb98317f72c4a8fa7135a4b
3
+ metadata.gz: 4fa5804fbad821dbd13f91cea0080a0871d070104805c6a37108d97583a57fdf
4
+ data.tar.gz: c50a466722893776d707aa4cf4789fd26f33a90be658cd47ea6399c1cdba6b1e
5
5
  SHA512:
6
- metadata.gz: 0b33a9ad3b68f399b21604fc8bc157234363ae0ac8581772d8f75f37aff4bea052ab7d5d98f6ed34ee4c1c952a37de497139746fece34d250b5bdfedd864e973
7
- data.tar.gz: abd98f35984405caa879bd2a2d940509fed8a25afde6a1c683659de2726ff79124ee9e1f0684092b77ac0097d9b32f85398221ddfc7f7b302e254f910c892df6
6
+ metadata.gz: 259c42ddc86175b6bd49d7720fbdd7efbd7688ba42f5fae7f9d40b2731b5a1bbf9645badc780562127de5560dcb2f0a6c31e61ef218de94a70eb077603b806e3
7
+ data.tar.gz: 84755692c25715b6c486020fb27a953c35323b8c0d7f6016bc4d4043059460144c3f46f05cc69317202e13da3cf58987f566cc0027d7d1edb585fea83f3f5d62
@@ -5,8 +5,8 @@ module RuCaptchaNumber
5
5
  headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
6
6
  headers['Pragma'] = 'no-cache'
7
7
  data = generate_rucaptcha
8
- opts = { disposition: 'inline', type: 'image/gif',filename: data[:filename] }
9
- send_data data[:image], opts
8
+ opts = { disposition: 'inline', type: 'image/gif' }
9
+ send_data data, opts
10
10
  end
11
11
  end
12
12
  end
@@ -8,7 +8,7 @@ module RuCaptchaNumber
8
8
 
9
9
  # filename key of rucaptcha
10
10
  def rucaptcha_filename
11
- filename = SecureRandom.hex
11
+ filename = params[:filename]
12
12
  filename_digest = Digest::SHA256.hexdigest(filename.inspect)
13
13
  ['rucaptcha-session', filename_digest].join(':')
14
14
  end
@@ -23,7 +23,7 @@ module RuCaptchaNumber
23
23
  filename = rucaptcha_filename
24
24
  RuCaptchaNumber.cache.write(filename, session_val, expires_in: RuCaptchaNumber.config.expires_in)
25
25
 
26
- {filename: filename,image: res[1]}
26
+ res[1]
27
27
  end
28
28
 
29
29
  # Verify captcha code
@@ -41,13 +41,10 @@ module RuCaptchaNumber
41
41
  def verify_rucaptcha?(resource = nil, opts = {})
42
42
  opts ||= {}
43
43
 
44
- if params[:filename].blank?
45
- return add_rucaptcha_validation_error
46
- end
47
44
 
48
- store_info = RuCaptchaNumber.cache.read(params[:filename])
45
+ store_info = RuCaptchaNumber.cache.read(rucaptcha_filename)
49
46
  # make sure move used key
50
- RuCaptchaNumber.cache.delete(params[:filename]) unless opts[:keep_session]
47
+ RuCaptchaNumber.cache.delete(rucaptcha_filename) unless opts[:keep_session]
51
48
 
52
49
  # Make sure session exist
53
50
  if store_info.blank?
@@ -1,3 +1,3 @@
1
1
  module RuCaptchaNumber
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rucaptcha_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roc Leung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-22 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties