rails_hq_ip_whitelist 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 407076a240656e2f204961c375000886f228920b
4
- data.tar.gz: a1d63e78384cb7a39f597632983c30869263dadf
3
+ metadata.gz: 97a1203a17253a73249e5ddd33e79c1a25e0b197
4
+ data.tar.gz: ec01f722791b5c9e7976c115385b6e4163f1383a
5
5
  SHA512:
6
- metadata.gz: 24ae2c696e12bc60c63e11088a233ddb0e8c50d8fec24e070ad4362d628418fdc7c4f8ab5297b9b64a52aaef3ad092e6cc288b5dda731ea6bcc3c269d9825fd7
7
- data.tar.gz: 504005d4a4fae897aa17f30151be2e630715accb8c02dcc1cb02f2ac6d1f5ebfc947428d0a08291d2cdb0f8b2df930806040ea6b6f1e4abbcf58d1c9b1cabf83
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
- raise IPWhiteListError.new(<<-MESSAGE.squish
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
@@ -1,3 +1,3 @@
1
1
  module IPWhitelist
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_hq_ip_whitelist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brendan Carney