rails_hq_ip_whitelist 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ip_whitelist/controller.rb +1 -1
- data/lib/ip_whitelist/version.rb +1 -1
- data/lib/rails_hq_ip_whitelist.rb +11 -7
- 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: 43ff93c4c0cb8c174b8c427aa7e8e21eec267aea
|
4
|
+
data.tar.gz: 9b985f1ce588aaebe20beab6b4d85618de3efbfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 244810dde9855922365df8ca7c5713d521446e2a4fefd62f8e690286c596014f4ba94ad0d408ddafaf4356ea6447757f9133e856f2bc4024b56d2d9e08b730de
|
7
|
+
data.tar.gz: c0ef60aa25b96789b547efae71a3cd29e4544f089fc9735dc92fa6a484b23f9400b2bac66be06715d95e82ca78217cfb6c8034bb2ea7bb6ba6ca01cb2093b463
|
@@ -13,7 +13,7 @@ module IPWhitelist
|
|
13
13
|
|
14
14
|
Rails.logger.info("#{current_user.username}'s IP (#{ip}) is not in authorized list (#{current_user.ip_whitelist.join(", " )})")
|
15
15
|
|
16
|
-
if redirect = IPWhitelist.
|
16
|
+
if redirect = IPWhitelist.redirect
|
17
17
|
redirect_to redirect
|
18
18
|
else
|
19
19
|
render text: "Not Authorized", status: 401
|
data/lib/ip_whitelist/version.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
1
|
require "ip_whitelist/controller"
|
2
2
|
module IPWhitelist
|
3
|
-
Configuration = Struct.new(:redirect)
|
4
3
|
|
5
|
-
|
6
|
-
|
4
|
+
def self.config
|
5
|
+
@config ||= ::ActiveSupport::OrderedOptions.new
|
7
6
|
end
|
8
7
|
|
9
|
-
def self.
|
10
|
-
|
8
|
+
def self.configure(&block)
|
9
|
+
config.instance_eval(&block)
|
11
10
|
end
|
12
11
|
|
13
|
-
def self.
|
14
|
-
|
12
|
+
def self.redirect
|
13
|
+
@redirect ||=
|
14
|
+
if config.redirect.is_a?(Proc)
|
15
|
+
config.redirect.call
|
16
|
+
else
|
17
|
+
config.redirect
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_hq_ip_whitelist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brendan Carney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|