allow pet data submissions from private-block IPs, not just 127.0.0.1
This commit is contained in:
parent
a55d1878ea
commit
1070778398
1 changed files with 4 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
require 'ipaddr'
|
||||
|
||||
class ApplicationController < ActionController::Base
|
||||
include FragmentLocalization
|
||||
|
||||
|
@ -27,8 +29,9 @@ class ApplicationController < ActionController::Base
|
|||
I18n.default_locale
|
||||
end
|
||||
|
||||
PRIVATE_IP_BLOCK = IPAddr.new('192.168.0.0/16')
|
||||
def local_only
|
||||
raise AccessDenied unless request.ip == '127.0.0.1'
|
||||
raise AccessDenied unless request.ip == '127.0.0.1' || PRIVATE_IP_BLOCK.include?(request.ip)
|
||||
end
|
||||
|
||||
def localized_fragment_exist?(key)
|
||||
|
|
Loading…
Reference in a new issue