Merge pull request #1748 from internetee/983-enable-subnets-in-whitelisting

Enable WhiteIp for checking against subnets
This commit is contained in:
Timo Võhmar 2020-11-24 14:56:48 +02:00 committed by GitHub
commit 60ad79178e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 4 deletions

View file

@ -29,6 +29,16 @@ class RegistrarAreaBaseTestTest < ApplicationSystemTestCase
assert_button 'Login'
end
def test_user_can_access_when_ip_is_whitelisted_with_subnet
white_ips(:one).update!(ipv4: '127.0.0.1/32', interfaces: [WhiteIp::REGISTRAR])
Setting.registrar_ip_whitelist_enabled = true
visit new_registrar_user_session_url
assert_no_text 'Access denied from IP 127.0.0.1'
assert_button 'Login'
end
def test_user_can_access_when_ip_is_not_whitelisted_and_whitelist_is_disabled
Setting.registrar_ip_whitelist_enabled = false
WhiteIp.delete_all