secure_escrow 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,10 +15,6 @@ module SecureEscrow
15
15
  end
16
16
 
17
17
  module ActionViewHelper
18
- DATA_ESCROW = 'data-escrow'
19
- IFRAME = 'iframe'
20
- POST = 'POST'
21
-
22
18
  def escrow_form_for record, options = {}, &proc
23
19
  options[:html] ||= {}
24
20
 
@@ -28,20 +24,36 @@ module SecureEscrow
28
24
  end
29
25
  apply_form_for_options!(record, options) unless stringy_record
30
26
 
31
-
32
- form_for record, escrow_options(options, POST), &proc
27
+ form_for record, ActionViewHelperSupportMethods.escrow_options(controller, request, options, ActionViewHelperSupportMethods::POST), &proc
33
28
  end
34
29
 
35
30
  def escrow_form_tag url_for_options = {}, options = {}, &block
36
- form_tag url_for_options, escrow_options(options, POST), &block
31
+ form_tag url_for_options, ActionViewHelperSupportMethods.escrow_options(controller, request, options, ActionViewHelperSupportMethods::POST), &block
37
32
  end
33
+ end
38
34
 
39
- private
40
- def escrow_options options, method
41
- # Rewrite URL to point to secure domain
42
- app = Rails.application
43
- config = app.config.secure_escrow
35
+ module ActionViewHelperSupportMethods
36
+ DATA_ESCROW = 'data-escrow'
37
+ IFRAME = 'iframe'
38
+ POST = 'POST'
39
+
40
+ def self.app
41
+ Rails.application
42
+ end
44
43
 
44
+ def self.config
45
+ app.config.secure_escrow
46
+ end
47
+
48
+ def self.iframe_necessary?
49
+ config.values_at(:secure_domain_name, :secure_domain_protocol, :secure_domain_port) !=
50
+ config.values_at(:insecure_domain_name, :secure_domain_protocol, :secure_domaina_port)
51
+ end
52
+
53
+ def self.escrow_options controller, request, options, method
54
+ return options unless iframe_necessary?
55
+
56
+ # Rewrite URL to point to secure domain
45
57
  submission_url = controller.url_for(
46
58
  app.routes.recognize_path(options[:url], method: method).
47
59
  merge(
@@ -61,4 +73,3 @@ module SecureEscrow
61
73
  end
62
74
  end
63
75
  end
64
-
@@ -1,3 +1,3 @@
1
1
  module SecureEscrow
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secure_escrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000 Z
12
+ date: 2012-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70114553359420 !ruby/object:Gem::Requirement
16
+ requirement: &70352265255060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70114553359420
24
+ version_requirements: *70352265255060
25
25
  description: SecureEscrow provides a content proxy for Rails applications allowing
26
26
  POSTing to secure actions from insecure domains without full-page refreshes
27
27
  email: