action_interceptor 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +107 -17
- data/Rakefile +1 -1
- data/lib/action_interceptor.rb +7 -4
- data/lib/action_interceptor/controller.rb +51 -37
- data/lib/action_interceptor/version.rb +1 -1
- data/spec/dummy/app/controllers/application_controller.rb +4 -0
- data/spec/dummy/app/controllers/home_controller.rb +10 -0
- data/spec/dummy/app/controllers/registrations_controller.rb +14 -0
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/initializers/action_interceptor.rb +11 -0
- data/spec/dummy/config/routes.rb +7 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/lib/action_interceptor/controller_spec.rb +57 -0
- data/spec/lib/action_interceptor/encryptor_spec.rb +19 -0
- data/spec/lib/action_interceptor_spec.rb +21 -0
- metadata +19 -22
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/db/development.sqlite3 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 329436e7ee0f1ad6c5ce0f1891cfe6c8ae7dbe76
|
4
|
+
data.tar.gz: 6f0b1b10adf2484ec53cb35245bcc02bf5d3e6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cbcf3eae9d54f8b3fd53e8b72708312af35a89336951246f933ecda523ef265525ce655825cecd83a150ed173fe6007936a29d5db834ca9ada91157afede299
|
7
|
+
data.tar.gz: d7bfd96282fe7e6b6b79b723250b694e7fca4f45bb623079824b53d582323dbc339dc4dbc15b68a72656356a6a357ff4c04220098b1915a13a3341668d335f41
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Action Interceptor is a Rails engine that makes it easy to have controllers intercept
|
6
6
|
actions from other controllers, have users perform a task and then return them to where
|
7
|
-
they were
|
7
|
+
they were when the interception happened.
|
8
8
|
|
9
9
|
This can be used, for example, for registration, authentication, signing terms of use, etc.
|
10
10
|
|
@@ -22,43 +22,132 @@ And then execute:
|
|
22
22
|
$ bundle install
|
23
23
|
```
|
24
24
|
|
25
|
+
Finally, run the following rake task to add
|
26
|
+
Action Interceptor's initializer to your application:
|
27
|
+
|
28
|
+
```sh
|
29
|
+
$ rake action_interceptor:install
|
30
|
+
```
|
31
|
+
|
25
32
|
## Usage
|
26
|
-
|
27
|
-
|
28
|
-
|
33
|
+
|
34
|
+
Interceptors are blocks of code that are declared in Action Interceptor's
|
35
|
+
initializer. They execute in the context of your controllers and work
|
36
|
+
very much like before_filters.
|
37
|
+
|
38
|
+
For example, the following interceptor could be used to ensure that users
|
39
|
+
have filled out a registration form:
|
29
40
|
|
30
41
|
```rb
|
31
|
-
interceptor
|
42
|
+
interceptor :registration do
|
43
|
+
|
44
|
+
return if current_user.try(:is_registered?)
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
format.html { redirect_to register_path }
|
48
|
+
format.json { head(:forbidden) }
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
32
52
|
```
|
33
|
-
|
34
|
-
|
53
|
+
|
54
|
+
What makes interceptors different from before_filters is that they will
|
55
|
+
save the user's current url before redirecting. This is done through
|
56
|
+
signed url params by default, falling back to session variables if those
|
57
|
+
params are absent or invalid.
|
58
|
+
|
59
|
+
Once declared, you can use an interceptor in any controller. For example,
|
60
|
+
you might want to ensure that all logged in users have to complete
|
61
|
+
a form before using your site. In that case, you could add the following
|
62
|
+
to your `ApplicationController`:
|
35
63
|
|
36
64
|
```rb
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
65
|
+
class ApplicationController < ActionController::Base
|
66
|
+
|
67
|
+
interceptor :registration
|
68
|
+
|
41
69
|
end
|
42
70
|
```
|
43
71
|
|
44
|
-
|
45
|
-
|
72
|
+
The controllers your interceptors redirect to should
|
73
|
+
call the `acts_as_interceptor` method:
|
74
|
+
|
75
|
+
```rb
|
76
|
+
class RegistrationsController < ApplicationController
|
77
|
+
|
78
|
+
acts_as_interceptor
|
79
|
+
|
80
|
+
skip_interceptor :registration, only: [:new, :create]
|
81
|
+
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
As shown above, interceptions work like before_filters and
|
86
|
+
can be skipped using the skip_interceptor method.
|
87
|
+
|
88
|
+
The `acts_as_interceptor` method will ensure the following:
|
89
|
+
|
90
|
+
- The `url_options` method for that controller will be overriden, causing all
|
91
|
+
links and redirects for the controller and associated views to include
|
92
|
+
the signed return url. This can be skipped by calling `acts_as_interceptor`
|
93
|
+
like this: `acts_as_interceptor override_url_options: false`. In that case,
|
94
|
+
you are responsible for passing the `intercepted_url_hash` to any internal
|
95
|
+
links and redirects.
|
96
|
+
|
97
|
+
- The following convenience methods will be added to the controller:
|
98
|
+
`redirect_back(options = {})`, `intercepted_url`, `intercepted_url=`,
|
99
|
+
`intercepted_url_hash`, `without_interceptor(&block)`,
|
100
|
+
`url_options_without_interceptor` and `url_options_with_interceptor`.
|
101
|
+
These methods have the following behavior:
|
102
|
+
|
103
|
+
- redirect_back(options = {}) redirects the user back to where the
|
104
|
+
interception occurred, passing the given options to the redirect method.
|
105
|
+
|
106
|
+
- `intercepted_url` returns the intercepted url. Can be used in views to make
|
107
|
+
links that redirect the user back to where the interception happened.
|
108
|
+
|
109
|
+
- `intercepted_url=` can be used to overwrite the intercepted url, if needed.
|
110
|
+
|
111
|
+
- `intercepted_url_hash` returns a hash containing the `interceptor_url_key`
|
112
|
+
and the signed `intercepted_url`.
|
113
|
+
|
114
|
+
- `without_interceptor(&block)` executes a block with the old url options.
|
115
|
+
|
116
|
+
- `url_options_without_interceptor` returns the old url options.
|
117
|
+
|
118
|
+
- `url_options_with_interceptor` returns the old url options merged with
|
119
|
+
the `intercepted_url_hash`. Can be used even if you specified
|
120
|
+
`override_url_options: false`.
|
121
|
+
|
122
|
+
When users complete the given task, use the following method to
|
123
|
+
redirect them back to where the interception occurred:
|
46
124
|
|
47
125
|
```rb
|
48
126
|
redirect_back
|
49
127
|
```
|
50
128
|
|
51
|
-
Alternatively, you can use `
|
129
|
+
Alternatively, you can use `intercepted_url` in views:
|
52
130
|
|
53
131
|
```erb
|
54
|
-
<%= link_to 'Back',
|
132
|
+
<%= link_to 'Back', intercepted_url %>
|
55
133
|
```
|
56
134
|
|
135
|
+
Finally, just by including the gem in your app, the following convenience
|
136
|
+
methods will be added to all controllers: `current_url`, `current_url_hash`,
|
137
|
+
`current_page?(url)` and `with_interceptor(&block)`.
|
138
|
+
|
139
|
+
- `current_url` returns the current url.
|
140
|
+
- `current_url_hash` returns a hash containing the `intercepted_url_key` and the
|
141
|
+
`current_url`, signed and encrypted.
|
142
|
+
- `current_page?(url)` returns true iif the given url is the `current_url`.
|
143
|
+
- `with_interceptor(&block)` executes the given block as if it was an
|
144
|
+
interceptor for the current controller.
|
145
|
+
|
57
146
|
## Contributing
|
58
147
|
|
59
148
|
1. Fork it
|
60
149
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
-
3. Write
|
150
|
+
3. Write specs for your feature
|
62
151
|
4. Implement your new feature
|
63
152
|
5. Test your feature (`rake`)
|
64
153
|
6. Commit your changes (`git commit -am 'Added some feature'`)
|
@@ -87,7 +176,8 @@ Alternatively, you can use `redirect_url` in views:
|
|
87
176
|
|
88
177
|
## Testing
|
89
178
|
|
90
|
-
To run all existing tests for
|
179
|
+
To run all existing tests for Action Interceptor,
|
180
|
+
simply execute the following from the main folder:
|
91
181
|
|
92
182
|
```sh
|
93
183
|
$ rake
|
data/Rakefile
CHANGED
data/lib/action_interceptor.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'action_interceptor/engine'
|
2
2
|
|
3
3
|
module ActionInterceptor
|
4
|
-
mattr_reader :intercepted_url_key
|
5
|
-
|
6
4
|
def self.intercepted_url_key(key = nil)
|
7
|
-
|
8
|
-
@intercepted_url_key
|
5
|
+
@intercepted_url_key = key unless key.blank?
|
6
|
+
@intercepted_url_key || :r
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.override_url_options(bool = nil)
|
10
|
+
@override_url_options = bool unless bool.nil?
|
11
|
+
@override_url_options.nil? ? true : @override_url_options
|
9
12
|
end
|
10
13
|
|
11
14
|
def self.interceptors
|
@@ -11,8 +11,6 @@ module ActionInterceptor
|
|
11
11
|
base.extend(ClassMethods)
|
12
12
|
end
|
13
13
|
|
14
|
-
protected
|
15
|
-
|
16
14
|
def current_url
|
17
15
|
"#{request.protocol}#{request.host_with_port}#{request.fullpath}"
|
18
16
|
end
|
@@ -22,7 +20,7 @@ module ActionInterceptor
|
|
22
20
|
url.blank? || URI(url).path == request.path
|
23
21
|
end
|
24
22
|
|
25
|
-
def
|
23
|
+
def current_url_hash
|
26
24
|
return @current_url_hash if @current_url_hash
|
27
25
|
|
28
26
|
key = ActionInterceptor.intercepted_url_key
|
@@ -33,14 +31,15 @@ module ActionInterceptor
|
|
33
31
|
@current_url_hash = {key => url}
|
34
32
|
end
|
35
33
|
|
36
|
-
|
37
|
-
|
34
|
+
# Executes the given block as if it was an interceptor
|
35
|
+
def with_interceptor(&block)
|
36
|
+
@previous_default_url_options ||= default_url_options
|
38
37
|
|
39
38
|
begin
|
40
39
|
# Send the referer with intercepted requests
|
41
40
|
# So we don't rely on the user's browser to do it for us
|
42
|
-
self.default_url_options = @
|
43
|
-
.merge(
|
41
|
+
self.default_url_options = @previous_default_url_options
|
42
|
+
.merge(current_url_hash)
|
44
43
|
|
45
44
|
# Execute the block as if it was defined in this controller
|
46
45
|
instance_exec &block
|
@@ -49,13 +48,13 @@ module ActionInterceptor
|
|
49
48
|
# and return the given value
|
50
49
|
e.exit_value
|
51
50
|
ensure
|
52
|
-
self.default_url_options = @
|
51
|
+
self.default_url_options = @previous_default_url_options
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
56
55
|
module ClassMethods
|
57
56
|
|
58
|
-
def
|
57
|
+
def interceptor(*interceptor_names, &block)
|
59
58
|
options = interceptor_names.extract_options!
|
60
59
|
filter_name = options.delete(:filter_name)
|
61
60
|
fnames = interceptor_names.collect do |iname|
|
@@ -66,7 +65,7 @@ module ActionInterceptor
|
|
66
65
|
blk = block || ActionInterceptor.interceptors[iname]
|
67
66
|
raise UndefinedInterceptor, iname unless blk
|
68
67
|
|
69
|
-
|
68
|
+
with_interceptor &blk
|
70
69
|
end
|
71
70
|
|
72
71
|
fname
|
@@ -75,7 +74,7 @@ module ActionInterceptor
|
|
75
74
|
before_filter *fnames, options
|
76
75
|
end
|
77
76
|
|
78
|
-
def
|
77
|
+
def skip_interceptor(*interceptor_names)
|
79
78
|
options = interceptor_names.extract_options!
|
80
79
|
filter_name = options.delete(:filter_name)
|
81
80
|
fnames = interceptor_names.collect do |iname|
|
@@ -85,36 +84,19 @@ module ActionInterceptor
|
|
85
84
|
skip_before_filter *fnames, options
|
86
85
|
end
|
87
86
|
|
88
|
-
def acts_as_interceptor
|
87
|
+
def acts_as_interceptor(options = {})
|
89
88
|
return if is_interceptor
|
90
89
|
self.is_interceptor = true
|
91
90
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
alias_method :url_options_without_interceptor, :url_options
|
97
|
-
|
98
|
-
def url_options
|
99
|
-
return @interceptor_url_options if @interceptor_url_options
|
100
|
-
|
101
|
-
url = Encryptor.encrypt_and_sign(intercepted_url)
|
102
|
-
key = ActionInterceptor.intercepted_url_key
|
103
|
-
@interceptor_url_options = {key => url}.merge(super)
|
104
|
-
end
|
91
|
+
@override_url_options = options[:override_url_options].nil? ? \
|
92
|
+
ActionInterceptor.override_url_options : \
|
93
|
+
options[:override_url_options]
|
105
94
|
|
106
|
-
|
107
|
-
url_options_with_interceptor = url_options
|
95
|
+
class_eval do
|
108
96
|
|
109
|
-
|
110
|
-
@interceptor_url_options = url_options_without_interceptor
|
111
|
-
yield block
|
112
|
-
ensure
|
113
|
-
@interceptor_url_options = url_options_with_interceptor
|
114
|
-
end
|
115
|
-
end
|
97
|
+
attr_writer :intercepted_url
|
116
98
|
|
117
|
-
|
99
|
+
helper_method :intercepted_url
|
118
100
|
|
119
101
|
def intercepted_url
|
120
102
|
return @intercepted_url if @intercepted_url
|
@@ -123,7 +105,7 @@ module ActionInterceptor
|
|
123
105
|
begin
|
124
106
|
# URL params are the most reliable, as they preserve
|
125
107
|
# state even if the user presses the back button
|
126
|
-
#
|
108
|
+
# We need to sign them to prevent the Open Redirect vulnerability
|
127
109
|
@intercepted_url = Encryptor.decrypt_and_verify(params[key])
|
128
110
|
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
129
111
|
# If the param is not available, use our best guess
|
@@ -137,11 +119,43 @@ module ActionInterceptor
|
|
137
119
|
@intercepted_url
|
138
120
|
end
|
139
121
|
|
122
|
+
def intercepted_url_hash
|
123
|
+
return @intercepted_url_hash if @intercepted_url_hash
|
124
|
+
url = Encryptor.encrypt_and_sign(intercepted_url)
|
125
|
+
key = ActionInterceptor.intercepted_url_key
|
126
|
+
|
127
|
+
@intercepted_url_hash = {key => url}
|
128
|
+
end
|
129
|
+
|
130
|
+
alias_method :url_options_without_interceptor, :url_options
|
131
|
+
|
132
|
+
def url_options_with_interceptor
|
133
|
+
return @url_options_with_interceptor \
|
134
|
+
if @url_options_with_interceptor
|
135
|
+
|
136
|
+
@url_options_with_interceptor = intercepted_url_hash.merge(
|
137
|
+
url_options_without_interceptor)
|
138
|
+
end
|
139
|
+
|
140
|
+
alias_method :url_options, :url_options_with_interceptor \
|
141
|
+
if @override_url_options.nil? || @override_url_options
|
142
|
+
|
143
|
+
def without_interceptor(&block)
|
144
|
+
previous_url_options = url_options_with_interceptor
|
145
|
+
|
146
|
+
begin
|
147
|
+
@url_options_with_interceptor = url_options_without_interceptor
|
148
|
+
yield block
|
149
|
+
ensure
|
150
|
+
@url_options_with_interceptor = previous_url_options
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
140
154
|
def redirect_back(options = {})
|
141
155
|
url = intercepted_url
|
142
156
|
|
143
157
|
# Disable the return_to param
|
144
|
-
|
158
|
+
without_interceptor do
|
145
159
|
# Convert '/' back to root_url
|
146
160
|
# Also, prevent self redirects
|
147
161
|
url = root_url if url == '/' || current_page?(url)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RegistrationsController < ActionController::Base
|
2
|
+
acts_as_interceptor
|
3
|
+
|
4
|
+
skip_interceptor :registration
|
5
|
+
|
6
|
+
def new
|
7
|
+
redirect_to registration_register_path
|
8
|
+
end
|
9
|
+
|
10
|
+
def register
|
11
|
+
redirect_back notice: 'Registration successful!'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
File without changes
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module ActionInterceptor
|
4
|
+
describe Controller do
|
5
|
+
|
6
|
+
it 'modifies ActionController::Base' do
|
7
|
+
expect(ActionController::Base).to respond_to(:is_interceptor)
|
8
|
+
expect(ActionController::Base).to respond_to(:interceptor_filters)
|
9
|
+
expect(ActionController::Base.is_interceptor).to be_false
|
10
|
+
expect(ActionController::Base.interceptor_filters).to be_a(Hash)
|
11
|
+
|
12
|
+
expect(ActionController::Base).to respond_to(:interceptor)
|
13
|
+
expect(ActionController::Base).to respond_to(:skip_interceptor)
|
14
|
+
expect(ActionController::Base).to respond_to(:acts_as_interceptor)
|
15
|
+
|
16
|
+
expect(ActionController::Base.new).to respond_to(:current_page?)
|
17
|
+
expect(ActionController::Base.new).to respond_to(:current_url)
|
18
|
+
expect(ActionController::Base.new).to respond_to(:current_url_hash)
|
19
|
+
expect(ActionController::Base.new).to respond_to(:with_interceptor)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'modifies classes that act_as_interceptor' do
|
23
|
+
expect(RegistrationsController.is_interceptor).to be_true
|
24
|
+
|
25
|
+
expect(RegistrationsController.new).to respond_to(:intercepted_url)
|
26
|
+
expect(RegistrationsController.new).to respond_to(:intercepted_url=)
|
27
|
+
expect(RegistrationsController.new).to respond_to(:intercepted_url_hash)
|
28
|
+
expect(RegistrationsController.new).to(
|
29
|
+
respond_to(:url_options_without_interceptor))
|
30
|
+
expect(RegistrationsController.new).to(
|
31
|
+
respond_to(:url_options_with_interceptor))
|
32
|
+
expect(RegistrationsController.new).to respond_to(:without_interceptor)
|
33
|
+
expect(RegistrationsController.new).to respond_to(:redirect_back)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'registers and skips before_filters' do
|
37
|
+
filters = RegistrationsController.new._process_action_callbacks
|
38
|
+
.collect{|c| c.filter}
|
39
|
+
expect(filters).not_to include(:my_interceptor)
|
40
|
+
|
41
|
+
RegistrationsController.interceptor :my_interceptor
|
42
|
+
filters = RegistrationsController.new._process_action_callbacks
|
43
|
+
.collect{|c| c.filter}
|
44
|
+
expect(filters).to include(:my_interceptor)
|
45
|
+
|
46
|
+
filters = ApplicationController.new._process_action_callbacks
|
47
|
+
.collect{|c| c.filter}
|
48
|
+
expect(filters).to include(:my_interceptor)
|
49
|
+
|
50
|
+
ApplicationController.skip_interceptor :my_interceptor
|
51
|
+
filters = ApplicationController.new._process_action_callbacks
|
52
|
+
.collect{|c| c.filter}
|
53
|
+
expect(filters).not_to include(:my_interceptor)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module ActionInterceptor
|
4
|
+
describe Encryptor do
|
5
|
+
|
6
|
+
it 'encrypts and decrypts strings' do
|
7
|
+
my_string = 'My string'
|
8
|
+
encrypted_string = Encryptor.encrypt_and_sign(my_string)
|
9
|
+
expect(encrypted_string).not_to include(my_string)
|
10
|
+
|
11
|
+
decrypted_string = Encryptor.decrypt_and_verify(encrypted_string)
|
12
|
+
expect(decrypted_string).to eq(my_string)
|
13
|
+
|
14
|
+
expect{Encryptor.decrypt_and_verify(my_string)}.to(
|
15
|
+
raise_error(ActiveSupport::MessageVerifier::InvalidSignature))
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActionInterceptor do
|
4
|
+
it 'must be configurable' do
|
5
|
+
expect(ActionInterceptor.intercepted_url_key).to eq(:dummy_key)
|
6
|
+
expect(ActionInterceptor.override_url_options).to be_true
|
7
|
+
expect(ActionInterceptor.interceptors.keys).to include(:registration)
|
8
|
+
|
9
|
+
my_block = lambda { 'my_block' }
|
10
|
+
|
11
|
+
ActionInterceptor.configure do
|
12
|
+
intercepted_url_key :my_key
|
13
|
+
override_url_options false
|
14
|
+
interceptor :my_name, &my_block
|
15
|
+
end
|
16
|
+
|
17
|
+
expect(ActionInterceptor.intercepted_url_key).to eq(:my_key)
|
18
|
+
expect(ActionInterceptor.override_url_options).to be_false
|
19
|
+
expect(ActionInterceptor.interceptors).to include({:my_name => my_block})
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_interceptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: public_suffix
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.9.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.9.1
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: sqlite3
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +52,9 @@ dependencies:
|
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
|
-
description:
|
70
|
-
|
55
|
+
description: Action Interceptor provides controllers that require users to perform
|
56
|
+
some task, then redirect them back to the page they were on. Useful for authentication,
|
57
|
+
registration, signing terms of use, etc.
|
71
58
|
email:
|
72
59
|
- dms3@rice.edu
|
73
60
|
executables: []
|
@@ -89,8 +76,9 @@ files:
|
|
89
76
|
- spec/dummy/app/assets/javascripts/application.js
|
90
77
|
- spec/dummy/app/assets/stylesheets/application.css
|
91
78
|
- spec/dummy/app/controllers/application_controller.rb
|
79
|
+
- spec/dummy/app/controllers/home_controller.rb
|
80
|
+
- spec/dummy/app/controllers/registrations_controller.rb
|
92
81
|
- spec/dummy/app/helpers/application_helper.rb
|
93
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
94
82
|
- spec/dummy/bin/bundle
|
95
83
|
- spec/dummy/bin/rails
|
96
84
|
- spec/dummy/bin/rake
|
@@ -102,6 +90,7 @@ files:
|
|
102
90
|
- spec/dummy/config/environments/development.rb
|
103
91
|
- spec/dummy/config/environments/production.rb
|
104
92
|
- spec/dummy/config/environments/test.rb
|
93
|
+
- spec/dummy/config/initializers/action_interceptor.rb
|
105
94
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
106
95
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
107
96
|
- spec/dummy/config/initializers/inflections.rb
|
@@ -111,13 +100,16 @@ files:
|
|
111
100
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
112
101
|
- spec/dummy/config/locales/en.yml
|
113
102
|
- spec/dummy/config/routes.rb
|
114
|
-
- spec/dummy/db/development.sqlite3
|
115
103
|
- spec/dummy/db/test.sqlite3
|
116
104
|
- spec/dummy/log/development.log
|
105
|
+
- spec/dummy/log/test.log
|
117
106
|
- spec/dummy/public/404.html
|
118
107
|
- spec/dummy/public/422.html
|
119
108
|
- spec/dummy/public/500.html
|
120
109
|
- spec/dummy/public/favicon.ico
|
110
|
+
- spec/lib/action_interceptor/controller_spec.rb
|
111
|
+
- spec/lib/action_interceptor/encryptor_spec.rb
|
112
|
+
- spec/lib/action_interceptor_spec.rb
|
121
113
|
- spec/spec_helper.rb
|
122
114
|
homepage: http://github.com/openstax/action_interceptor
|
123
115
|
licenses:
|
@@ -147,8 +139,9 @@ test_files:
|
|
147
139
|
- spec/dummy/app/assets/javascripts/application.js
|
148
140
|
- spec/dummy/app/assets/stylesheets/application.css
|
149
141
|
- spec/dummy/app/controllers/application_controller.rb
|
142
|
+
- spec/dummy/app/controllers/home_controller.rb
|
143
|
+
- spec/dummy/app/controllers/registrations_controller.rb
|
150
144
|
- spec/dummy/app/helpers/application_helper.rb
|
151
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
152
145
|
- spec/dummy/bin/bundle
|
153
146
|
- spec/dummy/bin/rails
|
154
147
|
- spec/dummy/bin/rake
|
@@ -159,6 +152,7 @@ test_files:
|
|
159
152
|
- spec/dummy/config/environments/development.rb
|
160
153
|
- spec/dummy/config/environments/production.rb
|
161
154
|
- spec/dummy/config/environments/test.rb
|
155
|
+
- spec/dummy/config/initializers/action_interceptor.rb
|
162
156
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
163
157
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
164
158
|
- spec/dummy/config/initializers/inflections.rb
|
@@ -169,13 +163,16 @@ test_files:
|
|
169
163
|
- spec/dummy/config/locales/en.yml
|
170
164
|
- spec/dummy/config/routes.rb
|
171
165
|
- spec/dummy/config.ru
|
172
|
-
- spec/dummy/db/development.sqlite3
|
173
166
|
- spec/dummy/db/test.sqlite3
|
174
167
|
- spec/dummy/log/development.log
|
168
|
+
- spec/dummy/log/test.log
|
175
169
|
- spec/dummy/public/404.html
|
176
170
|
- spec/dummy/public/422.html
|
177
171
|
- spec/dummy/public/500.html
|
178
172
|
- spec/dummy/public/favicon.ico
|
179
173
|
- spec/dummy/Rakefile
|
180
174
|
- spec/dummy/README.md
|
175
|
+
- spec/lib/action_interceptor/controller_spec.rb
|
176
|
+
- spec/lib/action_interceptor/encryptor_spec.rb
|
177
|
+
- spec/lib/action_interceptor_spec.rb
|
181
178
|
- spec/spec_helper.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
-
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
Binary file
|