diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index 9b8947103..97ce7368a 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -16,6 +16,7 @@ # from django import forms +from django.core import validators from gettext import gettext as _ from plinth import network @@ -33,11 +34,16 @@ class AddEthernetForm(forms.Form): name = forms.CharField(label=_('Connection Name')) zone = forms.ChoiceField( label=_('Firewall Zone'), + help_text=_('The firewall zone will control which services are \ +available over this interfaces. Select Internal only for trusted networks.'), choices=[('external', 'External'), ('internal', 'Internal')]) ipv4_method = forms.ChoiceField( label=_('IPv4 Addressing Method'), choices=[('auto', 'Automatic (DHCP)'), ('manual', 'Manual')]) - ipv4_address = forms.CharField(label=_('Address'), required=False) + ipv4_address = forms.CharField( + label=_('Address'), + validators=[validators.validate_ipv4_address], + required=False) class AddWifiForm(forms.Form): @@ -45,13 +51,22 @@ class AddWifiForm(forms.Form): name = forms.CharField(label=_('Connection Name')) zone = forms.ChoiceField( label=_('Firewall Zone'), + help_text=_('The firewall zone will control which services are \ +available over this interfaces. Select Internal only for trusted networks.'), choices=[('external', 'External'), ('internal', 'Internal')]) - ssid = forms.CharField(label=_('SSID')) + ssid = forms.CharField( + label=_('SSID'), + help_text=_('The visible name of the network.')) auth_mode = forms.ChoiceField( label=_('Authentication Mode'), + help_text=_('Select WPA if the wireless network is secured and \ +requires clients to have the password to connect.'), choices=[('wpa', 'WPA'), ('open', 'Open')]) passphrase = forms.CharField(label=_('Passphrase'), required=False) ipv4_method = forms.ChoiceField( label=_('IPv4 Addressing Method'), choices=[('auto', 'Automatic (DHCP)'), ('manual', 'Manual')]) - ipv4_address = forms.CharField(label=_('Address'), required=False) + ipv4_address = forms.CharField( + label=_('Address'), + validators=[validators.validate_ipv4_address], + required=False) diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py index 6b5aacfe3..d5d4dd42b 100644 --- a/plinth/modules/networks/networks.py +++ b/plinth/modules/networks/networks.py @@ -15,7 +15,6 @@ # along with this program. If not, see . # -from dbus.exceptions import DBusException from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.urlresolvers import reverse_lazy @@ -100,6 +99,11 @@ def edit(request, conn_id): _('Cannot edit connection %s: ' 'Connection type not supported.') % name) return redirect(reverse_lazy('networks:index')) + else: + return TemplateResponse(request, 'connections_edit.html', + {'title': _('Edit Connection'), + 'subsubmenu': subsubmenu, + 'form': form}) else: try: form_data['zone'] = settings['connection']['zone'] diff --git a/plinth/modules/networks/templates/connections_create.html b/plinth/modules/networks/templates/connections_create.html index 5c25315b8..a42f162c8 100644 --- a/plinth/modules/networks/templates/connections_create.html +++ b/plinth/modules/networks/templates/connections_create.html @@ -42,16 +42,19 @@