traptcha 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,19 @@
1
1
  class Traptcha::CaptchasController < ApplicationController
2
+ before_filter :set_cache_buster
3
+
2
4
  def show
3
5
  session[:captcha] = generated_captcha.value
4
- send_data generated_captcha.to_png
6
+ send_data generated_captcha.to_png, :disposition => 'inline', :type => 'image/png'
5
7
  end
6
8
 
7
9
  protected
8
-
10
+
11
+ def set_cache_buster
12
+    response.headers['Cache-Control'] = 'no-cache, no-store, max-age=0, must-revalidate'
13
+    response.headers['Pragma']        = 'no-cache'
14
+    response.headers['Expires']       = 'Fri, 01 Jan 1990 00:00:00 GMT'
15
+  end
16
+
9
17
  def generated_captcha
10
18
  @generated_captcha ||= Traptcha::Captcha.generate
11
19
  end
@@ -1,3 +1,3 @@
1
1
  module Traptcha
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -1,8 +1,8 @@
1
1
  module Traptcha
2
2
  module ViewHelpers
3
3
  def captcha_image_tag
4
- tag :img, :src => captcha_path, :id => 'traptcha', :alt => 'captcha'
5
- end
4
+      tag :img, :src => "#{captcha_path}?#{rand}", :id => 'traptcha', :alt => 'captcha'
5
+    end
6
6
 
7
7
  def captcha_label_tag
8
8
  label_tag :captcha
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traptcha
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rodrigo Navarro
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-04 00:00:00 -03:00
18
+ date: 2011-09-14 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency