🐛 Fix handling of unset remote addresses
This commit is contained in:
1 parent
6471a04a86
commit
010221ab5b
3 files changed
+8
-2
No files matched your search
@@ -584,7 +584,8 @@ def passive_login():
|
||||
elif settings().getBoolean(["accessControl", "autologinLocal"]) \
|
||||
and settings().get(["accessControl", "autologinAs"]) is not None \
|
||||
and settings().get(["accessControl", "localNetworks"]) is not None \
|
||||
and not "active_logout" in flask.request.cookies:
|
||||
and not "active_logout" in flask.request.cookies \
|
||||
and remote_address:
|
||||
# attempt local autologin
|
||||
autologin_as = settings().get(["accessControl", "autologinAs"])
|
||||
local_networks = _local_networks()
|
||||
|
||||
@@ -45,6 +45,10 @@ else:
|
||||
HAS_V6 = False
|
||||
|
||||
def is_lan_address(address, additional_private=None):
|
||||
if not address:
|
||||
# no address is LAN address
|
||||
return True
|
||||
|
||||
try:
|
||||
address = unmap_v4_as_v6(address)
|
||||
address = strip_interface_tag(address)
|
||||
|
||||
@@ -44,7 +44,8 @@ class UtilNetTest(unittest.TestCase):
|
||||
("11.1.2.3", ["11/8"], True),
|
||||
("12.1.1.123", [], True),
|
||||
("2a01:4f8:1c0c:6958::1:23", [], True),
|
||||
("fe80::89f3:31bb:ced0:2093%wlan0", [], True)
|
||||
("fe80::89f3:31bb:ced0:2093%wlan0", [], True),
|
||||
(None, [], True)
|
||||
)
|
||||
@ddt.unpack
|
||||
@mock.patch("netifaces.interfaces", side_effect=patched_interfaces)
|
||||
|
||||
Reference in new issue
Block a user