rails_hq_ip_whitelist 0.0.3 → 0.0.4
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/lib/ip_whitelist/controller.rb +1 -6
- data/lib/ip_whitelist/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a1203a17253a73249e5ddd33e79c1a25e0b197
|
4
|
+
data.tar.gz: ec01f722791b5c9e7976c115385b6e4163f1383a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e43f20501f5c96bc3947747bb48884366192d7e596df6f54c04dd6f5205c33c0665e592fb6aded91e5560009f0b7445b16067f36b24a33cb4501066cd41746
|
7
|
+
data.tar.gz: eb2ff6a74f4d058f934252f59150940a76a26651e10efb3fcbb42cf526b651e0b8755893166cc0e97d303e67587c3ab01a7a193e4861f774f8dd798a079621fb
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module IPWhitelist
|
2
2
|
module Controller
|
3
|
-
class IPWhitelistError < StandardError; end
|
4
3
|
def self.included(base)
|
5
4
|
base.before_action :check_ip_whitelist
|
6
5
|
end
|
@@ -10,11 +9,7 @@ module IPWhitelist
|
|
10
9
|
# Since requests can come through cloudflare, try that IP first.
|
11
10
|
ip = request.headers["CF-Connecting-IP"] || request.headers["REMOTE_ADDR"]
|
12
11
|
return if current_user.ip_whitelist.map(&:to_s).include?(ip)
|
13
|
-
|
14
|
-
IP #{ip} is not in the whitelist for user #{current_user.username}.
|
15
|
-
Whitelist: #{current_user.ip_whitelist.map(&:to_s)}
|
16
|
-
MESSAGE
|
17
|
-
)
|
12
|
+
render text: "Not Authorized", status: 401
|
18
13
|
end
|
19
14
|
end
|
20
15
|
end
|
data/lib/ip_whitelist/version.rb
CHANGED