mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
networks: Fix error during creation of PPPoE connections
- Currently, when trying to create PPPoE connection, we get an exception that dns_over_tls key is not found in the form's cleaned_data. Fix this by not expecting the field to be present only for PPPoE connections. Tests: - Edit a regular Ethernet connection and change the value of DNS-over-TLS to all the different values and notice that the value is updated as expected. - Create a regular Ethernet connection with non-default value for DNS-over-TLS. The value for DNS-over-TLS on the connection set as expected. - Create/edit/delete of a PPPoE connection works. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
e20e27c0fd
commit
c4b21b014b
@ -195,12 +195,16 @@ class ConnectionForm(forms.Form):
|
|||||||
'name': self.cleaned_data['name'],
|
'name': self.cleaned_data['name'],
|
||||||
'interface': self.cleaned_data['interface'],
|
'interface': self.cleaned_data['interface'],
|
||||||
'zone': self.cleaned_data['zone'],
|
'zone': self.cleaned_data['zone'],
|
||||||
'dns_over_tls': self.cleaned_data['dns_over_tls'],
|
|
||||||
}
|
}
|
||||||
|
settings['common'] |= self.get_privacy_settings()
|
||||||
settings['ipv4'] = self.get_ipv4_settings()
|
settings['ipv4'] = self.get_ipv4_settings()
|
||||||
settings['ipv6'] = self.get_ipv6_settings()
|
settings['ipv6'] = self.get_ipv6_settings()
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
def get_privacy_settings(self) -> dict[str, object]:
|
||||||
|
"""Return privacy dict from cleaned data."""
|
||||||
|
return {'dns_over_tls': self.cleaned_data['dns_over_tls']}
|
||||||
|
|
||||||
def get_ipv4_settings(self):
|
def get_ipv4_settings(self):
|
||||||
"""Return IPv4 dict from cleaned data."""
|
"""Return IPv4 dict from cleaned data."""
|
||||||
ipv4 = {
|
ipv4 = {
|
||||||
@ -290,6 +294,10 @@ class PPPoEForm(EthernetForm):
|
|||||||
}
|
}
|
||||||
return settings
|
return settings
|
||||||
|
|
||||||
|
def get_privacy_settings(self) -> dict[str, object]:
|
||||||
|
"""Return privacy dict from cleaned data."""
|
||||||
|
return {}
|
||||||
|
|
||||||
def get_ipv4_settings(self):
|
def get_ipv4_settings(self):
|
||||||
"""Return IPv4 settings from cleaned data."""
|
"""Return IPv4 settings from cleaned data."""
|
||||||
return None
|
return None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user