action_interceptor 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action_interceptor/controller.rb +18 -8
- data/lib/action_interceptor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e855e9e9869ca8e5d409a7016be38bd81f560a
|
4
|
+
data.tar.gz: 5ee08d985554e577b922afd1b5d53db794782794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08c253742ec490768f8cac0f082f2692a8b025153a2768c8a2832c64874be5755c1a45ad0542ebc6f7cf226278665131e487d2c714ca3d5043e47bc442c099f2
|
7
|
+
data.tar.gz: fe5c9c8635292d2db08b17837f82743d6d14eb645707c702fb26119daf1424a22afaa2e10377f1350f07ac416922ae04465aaf8e82206dd7195a8035708b6029
|
@@ -28,7 +28,8 @@ module ActionInterceptor
|
|
28
28
|
key = ActionInterceptor.intercepted_url_key
|
29
29
|
|
30
30
|
# Can't redirect back to non-get
|
31
|
-
|
31
|
+
# Also, can't call root_url here, so use '/' instead
|
32
|
+
url = Encryptor.encrypt_and_sign(request.get? ? current_url : '/')
|
32
33
|
@current_url_hash = {key => url}
|
33
34
|
end
|
34
35
|
|
@@ -104,11 +105,17 @@ module ActionInterceptor
|
|
104
105
|
|
105
106
|
def without_interceptor_url_options(&block)
|
106
107
|
url_options_with_interceptor = url_options
|
107
|
-
|
108
|
-
|
109
|
-
|
108
|
+
|
109
|
+
begin
|
110
|
+
@interceptor_url_options = url_options_without_interceptor
|
111
|
+
yield block
|
112
|
+
ensure
|
113
|
+
@interceptor_url_options = url_options_with_interceptor
|
114
|
+
end
|
110
115
|
end
|
111
116
|
|
117
|
+
alias_method :without_interceptor, :without_interceptor_url_options
|
118
|
+
|
112
119
|
def intercepted_url
|
113
120
|
return @intercepted_url if @intercepted_url
|
114
121
|
|
@@ -133,11 +140,14 @@ module ActionInterceptor
|
|
133
140
|
def redirect_back(options = {})
|
134
141
|
url = intercepted_url
|
135
142
|
|
136
|
-
#
|
137
|
-
|
138
|
-
|
143
|
+
# Disable the return_to param
|
144
|
+
without_interceptor_url_options do
|
145
|
+
# Convert '/' back to root_url
|
146
|
+
# Also, prevent self redirects
|
147
|
+
url = root_url if url == '/' || current_page?(url)
|
139
148
|
|
140
|
-
|
149
|
+
redirect_to url, options
|
150
|
+
end
|
141
151
|
end
|
142
152
|
|
143
153
|
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.0.3
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|